Return value of an assignment statement?
paul.nospam at rudin.co.uk
Sat Feb 23 10:39:13 CET 2008
Steven D'Aprano <steve at REMOVE-THIS-cybersource.com.au> writes:
> 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. Names are associated with namespaces, not objects. A
> name must have one and only one object bound to it at any one time;
> 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.
Of course it all depends on how you choose to define "variable". Every
programming language has slightly different semantics for
variables. It would be perverse to describe something as a variable if
it lacked any similarities with such in other programming languages,
but I think it is misleading to say "python doesn't have variables".
More information about the Python-list