Terminology: "reference" versus "pointer"

Random832 random832 at fastmail.com
Sun Sep 13 19:38:37 EDT 2015


On Sun, Sep 13, 2015, at 19:17, Akira Li wrote:
> "do not physically exist" does not make sense. Objects are *never*
> destroyed explicitly in Python (you can only make them
> *unreachable*).

But the objects we've talking about have never been created, because the
__getitem__ method has not been called, because we're talking about the
structure of what _is there_, not the idea of what will happen after you
call some method. The (range, or whatever) object holds no
reference/pointer/whatever (maybe we should just call them arrows?) to
the objects that it will create when you call __getitem__, or even to
the ones that it has created when you've called it, so it doesn't make
sense to put a box in it that will have an arrow pointing to those
objects.

> You can disable garbage collection completely and it is
> still will be Python. Immutable objects can be considered immortal e.g.:
> 
>  (1+1) -- question: does the object that represents int(2) exist before
>                     the expression is evaluated?
> 
> The correct answer: it does not matter: int(2) can be created on the
> fly, a cached int(2) can be reused by a specific implementation --
> Python doesn't care.
> 
> I don't see why the model that can't describe range(1) in Python 3
> pretends to be complete.

Why can't it describe range(1)? A range object in my model would include
the start, stop, and step; _not_ the contents of what you would get by
iterating over it; since that's not part of the physical structure of
the object, but the consequences of calling methods on it.



More information about the Python-list mailing list