git.net

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

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


Paul Rudin <paul.nospam at rudin.co.uk>:

> Marko Rauhamaa <marko at pacujo.net> writes:
>> 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", [...] it's
> better (IMO) to just talk in the terms the language specification
> uses.

The spec (<URL: https://docs.python.org/3/reference/datamodel.html>)
uses the terms *identity* and *reference*, which are one-to-one.

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

The spec as well as Python itself uses the word "name" for various
strings:

   >>> "x".__class__.__name__
   'str'
   >>> __name__
   '__main__'


So your "names" are *variables*.

Your "mechanisms" are *references*.

Your "objects" are *objects*.

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

Unfortunately, virtually every word is overloaded and full of
preconceived notions. Hence: "pegs", "leashes", "puppies".

The main thing is to keep those three concepts apart from each other.
Two notions will not suffice.


Marko