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

Marko Rauhamaa marko at pacujo.net
Thu Jun 9 15:35:09 EDT 2016


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

> Marko Rauhamaa <marko at pacujo.net> writes:
>> The spec (<URL: https://docs.python.org/3/reference/datamodel.html>)
>> uses the terms *identity* and *reference*, which are one-to-one.
>
> identity isn't the same thing as a name, identity is an inherent
> property of an object - many names may refer to the same object.

    x is y    if and only if    id(x) == id(y)

However, sorry for muddling the discussion by bringing in the identity.
I'll leave it out for now.

>> So your "names" are *variables*.
>
> Informally yes, but "variable" has no meaning in the language reference.

Really? How do you interpret these, then?

   Although the definition of assignment implies that overlaps between
   the left-hand side and the right-hand side are ‘simultaneous’ (for
   example a, b = b, a swaps two variables), overlaps within the
   collection of assigned-to variables occur left-to-right, sometimes
   resulting in confusion.

   <URL: https://docs.python.org/3/reference/simple_stmts.html?#assignme
   nt-statements>


   Assignments to __debug__ are illegal. The value for the built-in
   variable is determined when the interpreter starts.

   <URL: https://docs.python.org/3/reference/simple_stmts.html?#the-asse
   rt-statement>


   The public names defined by a module are determined by checking the
   module’s namespace for a variable named __all__

   <URL: https://docs.python.org/3/reference/simple_stmts.html?#the-impo
   rt-statement>

   It would be impossible to assign to a global variable without global,
   although free variables may refer to globals without being declared
   global.

   <URL: https://docs.python.org/3/reference/simple_stmts.html?#the-glob
   al-statement>

>> 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.
>
> Well - adding more things is confusing in IMO - we have a language
> reference, let's just use the terms in the language reference.

I have quoted "the language reference" quite a bit. Your turn.

You would be correct that there is something of an faux elitism going
around that is influencing the language spec as well to a degree. It
appears some people consider "variables," "assignments," "pointers" etc
to be too riff-raff. So people want to say Python is unlike C and has
"names," "bindings," "references" etc.

There's no shame in stating directly that Python has variables just like
C even though Python's variables are not first-class. There's no
difference between binding and assignment. And a reference is a synonym
to a pointer.

Python still has good stuff C doesn't, or even Java.


Marko



More information about the Python-list mailing list