Explanation of list reference

Ian Kelly ian.g.kelly at gmail.com
Fri Feb 14 15:17:33 EST 2014


On Fri, Feb 14, 2014 at 12:56 PM, Marko Rauhamaa <marko at pacujo.net> wrote:
> There are two fundamentally different kinds of values in Python: "small"
> values and "big" values. A variable can only hold a small value. A list
> element can only hold a small value. A dictionary entry can only hold a
> small value. The same is true for an object member (aka field).
>
> So we have four kinds of (memory) slots: variables, list elements,
> dictionary entries and fields. Any slot can only hold a small value.
>
> The small values include numbers, booleans (True or False) and
> references. All other values are big, too big to fit in a slot. They
> have to be stored in a "vault" big enough to hold them. This vault is
> called the heap. Big values cannot be stored in slots directly; instead,
> references to big values are used.

This is nonsense.  Python the language makes no such distinction
between "big" and "small" values.  *All* objects in CPython are stored
internally on the heap.  Other implementations may use different
memory management schemes.



More information about the Python-list mailing list