Nested function scope problem

Gerhard Fiedler gelists at gmail.com
Fri Jul 28 14:54:04 EDT 2006


On 2006-07-28 15:20:52, Antoon Pardon wrote:

>> Typically, "variable" implies a data storage location that can take on
>> different values. Emphasis on "location" -- the name is fixed to a
>> memory location whose contents can be varied.
> 
> That is not true. It may be the case in a number of languages but my
> experience with lisp and smalltalk, though rather limited, says that no
> such memory location is implied with the word "variable" in those
> languages and AFAIK they don't have a problem with the word "variable"
> either. 
> 
>> In Python, the closest would be a mutable object.

Maybe this gets somewhere. Consider variable != constant. Python names are
variables in that what they refer to (what is associated with them through
a dict) can be changed, through various means (most commonly assignment).
They are also variables in that what they refer to (usually) can be
changed. Whether an assignment or some other command changes the reference
association or the referenced object is one of the confusing issues with
Python. But that doesn't make a variable less variable... :)

Gerhard




More information about the Python-list mailing list