Dave Malcolm <dmalc...@redhat.com> added the comment:

>From IRC discussion, how about something like:

The current implementation consolidates integers in the range -5 to 256 
(inclusive) into singleton PyIntObject instances, whereas other integer values 
have unique PyIntObject instances created for them.

This means that on CPython::

   >>> -5 is -5
   True

but::

   >>> -6 is not -6
   False

This behavior is an implementation detail of CPython, and is not required by 
other implementations of Python.

In particular:
  - do not manipulate the internal value of a PyIntObject after creation
  - do not use "is" for comparing integer values, use "==" instead.

----------
nosy: +dmalcolm

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue11846>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to