a = b = 1 just syntactic sugar?
FBatista at uniFON.com.ar
Tue Jun 3 19:42:18 CEST 2003
#- I think if a language supports a = b = 1
#- then that means "b = 1" returns a value
#- of 1, which can be assigned to any variable.
#- But it seems like it is only a syntactic sugar
#- in Python?
>>> a = b = 2
>>> a is b
"b = 1" does not return 1, just returns b. a and b are the same object now
(they are not just equal, they are the very same).
More information about the Python-list