This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author dmalcolm
Recipients antlong, dmalcolm
Date 2011-04-14.21:17:04
SpamBayes Score 1.3611154e-08
Marked as misclassified No
Message-id <1302815825.55.0.411716078212.issue11846@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2011-04-14 21:17:05dmalcolmsetrecipients: + dmalcolm, antlong
2011-04-14 21:17:05dmalcolmsetmessageid: <1302815825.55.0.411716078212.issue11846@psf.upfronthosting.co.za>
2011-04-14 21:17:05dmalcolmlinkissue11846 messages
2011-04-14 21:17:04dmalcolmcreate