I'm wrong or Will we fix the ducks limp?

Paul Rudin paul.nospam at rudin.co.uk
Thu Jun 9 10:09:13 EDT 2016


Marko Rauhamaa <marko at pacujo.net> writes:

> Paul Rudin <paul.nospam at rudin.co.uk>:
>
>> Marko Rauhamaa <marko at pacujo.net> writes:
>>> What is different is that in Python, every expression evaluates to a
>>> pointer. Thus, you can only assign pointers to variables.
>>
>> I don't think that's really right - every expression evaluates to an
>> object.
>
> The object is only an intermediate result; what is returned is a pointer
> (to an object), without an exception. That's not a matter of
> implementation. It's an essential part of Python's data model.
>

Well - the language has no explicit notion of "pointer", so I'm not sure
it's really correct to say that it's an essential part of the data
model. The way variables are used to reference the objects associated
with them from time to time has some similarities with pointer semantics
in other languages. But actually it's better (IMO) to just talk in the
terms the language specification uses. 

There are names and objects, and mechanisms by which names come to refer
to objects according to the execution model.


> (However, since "pointer" is evokes passions among crowds, it is better
> to use the neutral word "leash".)


Talk of pointers is potentially confusing, because it carries baggage
from other languages which doesn't necessary map precisely onto the
python execution model.


(The underlying cpython implementation, is neither here nor there - we
could in theory implement python in some other language which lacks a
pointer type.)



More information about the Python-list mailing list