operator overloading + - / * = etc...

Piet van Oostrum piet at cs.uu.nl
Fri Oct 13 05:34:06 EDT 2006


>>>>> Fredrik Lundh <fredrik at pythonware.com> (FL) wrote:

>FL> Piet van Oostrum wrote:
>>> The official Python documentation (language reference manual) talks a lot
>>> about variables. So it seems silly to say that Python doesn't have
>>> variables.

>FL> the language reference mostly uses the term "variables" when discussing
>FL> local variables and instance variables, and is (usually) careful to talk
>FL> about "names" when talking about binding behaviour.

Mostly yes, but not exclusively. E.g.
  If a name is bound in a block, it is a local variable of that block. If a
  name is bound at the module level, it is a global variable. (The
  variables of the module code block are local and global.) If a variable
  is used in a code block but not defined there, it is a free variable. 

There are also other uses of variable for things at the module level. And
the word `variable(s)' occurs 80 times in the language reference manual.

>FL> for example, the description of the assignment statement:

>FL>   http://www.python.org/doc/2.4.3/ref/assignment.html

>FL> only uses "variable" twice, in a note that discussing a given code
>FL> example. the more formal parts of that page consistently use the term
>FL> "name".

>FL> it's often a good idea to be a bit careful when discussing detailed
>FL> behaviour, especially in contexts where the audience may associate
>FL> variables with "small areas of memory".

It is interesting that the word 'variable' is nowhere defined in the
manual. What one imagines with the word `variable' depends on one's
programming background, I guess, and that could certainly give a wrong
impression. 
-- 
Piet van Oostrum <piet at cs.uu.nl>
URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4]
Private email: piet at vanoostrum.org



More information about the Python-list mailing list