The only way to ensure it will *always* work is when sharing values: Python 2.5.2 (r252:60911, Feb 22 2008, 07:57:53) [GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin >>> c1 = 'red' ; c2 = 'green' ; colors = (c1, c2) >>> [x is c2 for x in colors] [False, True]
Any new list will break the identity: >>> [x is c2 for x in 'red green'.split()] [False, False] >>> [x is 'green' for x in 'red green'.split()] [False, False] I'm baffled... _______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig