[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Explanation of list reference

Ian Kelly <ian.g.kelly at gmail.com>:

> 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.

You're right, of course. Conceptually, the "everything is a reference"
and the "small"/"big" distinction are equivalent (produce the same
outcomes). The question is, which model is easier for a beginner to

Say you write:

   1 + 2

You may not find it most intuitive to follow through the object
instantiation and reference manipulation implicit in the "everything is
a reference" model when you think you understand numbers but have little
idea of memory, objects, heap, allocation etc.