Python是否有静态对象、栈对象和堆对象?
Does Python have static objects, stack objects and heap objects?
来自编程语言语用学,作者:Scott
Object lifetimes generally correspond to one of three principal
storage allocation mechanisms, used to manage the object’s space:
Static objects are given an absolute address that is retained throughout the program’s execution.
Stack objects are allocated and deallocated in last-in, first-out order, usually in conjunction with subroutine calls and returns.
Heap objects may be allocated and deallocated at arbitrary times. They require a more general (and expensive) storage management
algorithm.
C语言有静态对象、栈对象和堆对象。
Python是否有静态对象、栈对象和堆对象?
我看到in another post CPython 分配堆上的所有对象。是不是说Python里面的对象都是堆对象?
但是Python也有静态方法。 Python PLP 书中的静态对象是静态方法吗?
谢谢。
Python 对象是 大部分 堆对象 - 然而,在 CPython[=20 中有一些特殊的 PyObject 单例值=] 在 C 中是 static;虽然这是一个实现细节。例如,通常的内置 types 具有静态存储持续时间。据我所知,没有堆栈 (Python) 个对象。
静态存储持续时间,正如这里理解的那样,与静态方法完全无关。
来自编程语言语用学,作者:Scott
Object lifetimes generally correspond to one of three principal storage allocation mechanisms, used to manage the object’s space:
Static objects are given an absolute address that is retained throughout the program’s execution.
Stack objects are allocated and deallocated in last-in, first-out order, usually in conjunction with subroutine calls and returns.
Heap objects may be allocated and deallocated at arbitrary times. They require a more general (and expensive) storage management algorithm.
C语言有静态对象、栈对象和堆对象。
Python是否有静态对象、栈对象和堆对象?
我看到in another post CPython 分配堆上的所有对象。是不是说Python里面的对象都是堆对象?
但是Python也有静态方法。 Python PLP 书中的静态对象是静态方法吗?
谢谢。
Python 对象是 大部分 堆对象 - 然而,在 CPython[=20 中有一些特殊的 PyObject 单例值=] 在 C 中是 static;虽然这是一个实现细节。例如,通常的内置 types 具有静态存储持续时间。据我所知,没有堆栈 (Python) 个对象。
静态存储持续时间,正如这里理解的那样,与静态方法完全无关。