I thought a string was stored as a unique object, so why isn't this evidenced by the code below ?
Python 2.5.2 (r252:60911, Feb 22 2008, 07:57:53) [GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin >>> [light is 'green' for light in 'green', 'red'] [True, False] >>> color = 'green' >>> [light is 'green' for light in 'green', 'red'] [False, False] >>> color = 1 >>> [light is 'green' for light in 'green', 'red'] [True, False] whereas: >>> [x is 1 for x in 1, 2] [True, False] whether the value 1 is assigned to some other variable or not... the id of 1 doesn't vary -- just what is the rationale behind that? I know I could use the == predicate instead, but just how many different greens (with different ids) can there be, and how do I know which one is under focus at a given time? -- Jym Feat ~ Paris FR 75018 _______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig