noob question

Marco marco.colombo at gmail.com
Tue Jun 28 11:22:20 EDT 2005


Steven D'Aprano <steve at REMOVETHIScyber.com.au> wrote in message news:<pan.2005.06.26.10.41.44.722005 at REMOVETHIScyber.com.au>...

> Can anyone think of some good, easy to understand examples of where
> Python's name/object model differs from the variable/value model?

a = b = [ 1 ]

a and b are _not_ two variables, each with [ 1 ] as value, but just two
names for the same object (a list). In other variable-based languages,
the above is equivalent to:

a = [ 1 ]
b = [ 1 ]

in Python it is not.

.TM.



More information about the Python-list mailing list