Python identity: Multiple personality disorder, need code shrink [duplicate]
Possible Duplicate: Python “is” operator behaves unexpectedly with integers I stumbled upon the following Python weirdity: >>> two = 2 >>> ii = 2 >>> id(two) == id(ii) True >>> [id(i) for i in [42,42,42,42]] [10084276, 10084276, 10084276, 10084276] >>> help(id) Help on built-in function id in module __builtin__: id(...) id(object) -> integer Return the identity of an object. This is guaranteed to be unique among simultaneously existing objects. (Hint: it's the object's memory address.) Is every number a unique object? Are different variables holding the same elemental values (for example, two