On Fri, 22 Feb 2008 12:32:10 +0000, Steven D'Aprano wrote: > On Fri, 22 Feb 2008 08:12:56 +0000, Marc 'BlackJack' Rintsch wrote: > >> A "variable" in programming languages is composed of a name, a memory >> location, possibly a type and a value. In C-like languages, where you >> put values in named and typed "boxes", the memory location and type are >> attached to the name. In Python both belong to the value. > > But Python objects don't have names, so by your own definition, they > aren't variables.
Exactly! Names aren't variables. The unit of a name, an address, and a value are a variable. > Names are associated with namespaces, not objects. A name must have one > and only one object bound to it at any one time; What is a binding when it's not an association between a name and an object!? So names are associated with objects. There are no names without objects in Python. If a name is not bound to any object, how could the name exist? That would be like a dangling pointer, a beast that doesn't exists in Python. <nitpick>Okay there are local names that are known and therefore somehow "exist" before they get bound, but that's IMHO an implementation detail.<nitpick> > objects on the other hand can be bound to one name, or no name, or a > thousand names. The object itself has no way of knowing what names it is > bound to, if any. > > Or, to put it another way... Python doesn't have variables. It has. You just can't substitute the term "name" with "variable" and expect it to behave like in C. A variable is not just the name but also the value and the storage space and how those are connected. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list