Closures in leu of pointers?

Michael Torrie torriem at gmail.com
Sat Jun 29 14:35:54 EDT 2013


On 06/29/2013 11:02 AM, Antoon Pardon wrote:
> Op 29-06-13 16:02, Michael Torrie schreef:
>>
>> The real problem here is that you don't understand how python variables
>> work.  And in fact, python does not have variables.  It has names that
>> bind to objects.
> 
> I don't understand why members of this list keep saying this. Sure the
> variables in python behave differently than those in C and algol  But 
> they behave similarly as those in smalltalk and lisp and I haven't seen
> anyone claim that smalltalk and lisp don't have variables.
> 
> We might as well say that C doesn't have variables, it has names
> pointing to memory locations or value containers or something
> like that.

Sure but a memory location that contains say an int in C *is* a
variable, with or without a name.   You can change the int stored in
that memory address at will, as part of your normal course.  Python's
basic data types are immutable.  At best we could say they are read-only
variables.

So no, saying Python doesn't have variables is not the same as saying C
doesn't have variables but only memory locations.  They are different
concepts entirely, though on the surface they look similar.

> 
> AFAICS there is no reason why "variable" wouldn't be appropiate
> for python names as opposed to C names.

Sure I see your point, but then again, calling them variables is what
led to the OP's issue in the first place.  So yes they look like
variables, and for the most part act like them, except when they don't.
 Hence the confusion and why I bring up the difference between python's
name binding mechanism and how a variable works. It's exactly the
concept that was tripping up the OP.



More information about the Python-list mailing list