negative numbers are not equal...
Carl Banks
pavlovevidence at gmail.com
Fri Aug 15 11:03:23 EDT 2008
On Aug 14, 4:42 pm, Christian Heimes <li... at cheimes.de> wrote:
> Integers
> between -5 and +256 are singletons as are some other objects like
> strings with one element or empty tuples.
Not quite.
Python 2.5.2 (r252:60911, May 28 2008, 08:35:32)
[GCC 4.2.4 (Debian 4.2.4-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> a = 'A'
>>> b = "%c" % a
>>> a
'A'
>>> b
'A'
>>> a is b
False
> You must not rely on the
> optimization.
Good advice.
Carl Banks
More information about the Python-list
mailing list