Tuple assignment and generators?

vdrab stijndesaeger at gmail.com
Fri May 5 10:26:24 EDT 2006


oh wow... it gets better...

>>> x = "test!"
>>> y = "test!"
>>> x is y
False
>>> x = "test"
>>> y = "test"
>>> x is y
True
>>>

... I had no clue.
I guess the take-away lesson is to steer clear from any reliance on
object identity checks, if at all possible.  Are there any other such
"optimizations" one should like to know about?
v.




More information about the Python-list mailing list