Message133770
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. |
|
Date |
User |
Action |
Args |
2011-04-14 21:17:05 | dmalcolm | set | recipients:
+ dmalcolm, antlong |
2011-04-14 21:17:05 | dmalcolm | set | messageid: <1302815825.55.0.411716078212.issue11846@psf.upfronthosting.co.za> |
2011-04-14 21:17:05 | dmalcolm | link | issue11846 messages |
2011-04-14 21:17:04 | dmalcolm | create | |
|