what is the keyword "is" for?

daniel daniel.huangfei at gmail.com
Tue Aug 15 04:04:46 EDT 2006


many thanks to Sybren and Kirk for your helpful explanation.

when I tried to check the stuff out, found sth interesting that if you
define variables in a style like this:
a = b = ['a', 'b']
changing one list affects the other, and they still refer to same
object. in fact, seems all compound types (dictionary for instance)
behave in this way.

however, when list is replaced with other built-in  types like integers
:
a = b = 3
changing one of them cause the two objects differ...


best regards.

daniel




More information about the Python-list mailing list