Python does not have any such thing.
Python is a language and does not indicate exactly how implementations should achieve the semantics defined by the Python language.
Each implementation (CPython, PyPy, IronPython, Stackless, Jython ...) is free to do its job!
In C Python, all objects are on the heap:
Python memory management includes a private heap containing all Python objects and data structures. one
The CPython virtual machine is stack-based:
>>> def g(): x = 1 y = 2 return f(x, y) >>> import dis >>> dis.dis(g) 2 0 LOAD_CONST 1 (1)
Keep in mind that this is specific to CPython. The stack does not contain actual values, but retains references to these objects.
1 : Source
phant0m Jan 27 '13 at 11:06 on 2013-01-27 11:06
source share