The “does Python have variables?” debate

Mark H Harris harrismh777 at gmail.com
Wed May 7 17:35:00 EDT 2014


On 5/7/14 4:15 PM, Marko Rauhamaa wrote:
>> That's why I always try to say “Python doesn't have variables the way
>> you might know from many other languages”,
>
> Please elaborate. To me, Python variables are like variables in all
> programming languages I know. Python currently does not allow me to
> obtain the "address" of a variable, but that doesn't make me think of
> Python variables any differently.

Here is the difference...  in almost every other language you know.

A = macTruck
B = A

In almost every other language you know A and B each "contain" by 
reference (and almost always by static type) macTruck. But NOT python.

A --> {macTruck} <-- B


In almost every other language you know there is some kind of binding 
table (name reference to type/length) and BOTH A and B are bound to data 
in memory macTruck... and usually its a different place in memory!

NOT python.

No doubt you may use A and B in python the way other people use their 
variables in their language... but it MEANS something different.


marcus




More information about the Python-list mailing list