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 terry.reedy
Recipients antlong, dmalcolm, eric.araujo, ezio.melotti, nedbat, pitrou, rhettinger, terry.reedy
Date 2011-04-25.18:45:57
SpamBayes Score 0.000131375
Marked as misclassified No
Message-id <>
The range of interned ints was once much smaller, but it was expanded upwards to 256 so that the bytes extracted from bytes and bytearray objects, as when indexing or iterating, would *all* be pre-allocated objects. I should presume that their indexers and iterators are cognizant of this and take advantage of this to bypass int() creation and directly index into the the array of preallocated ints without a range check.

As for space and some time saving, just on startup,
a nearly fresh IDLE shell shows

>>> sum((sys.getrefcount(i) for i in range(-5, 257)))

There are hundreds of references for each of 0 and 1.
Date User Action Args
2011-04-25 18:45:59terry.reedysetrecipients: + terry.reedy, rhettinger, pitrou, nedbat, ezio.melotti, eric.araujo, dmalcolm, antlong
2011-04-25 18:45:59terry.reedysetmessageid: <>
2011-04-25 18:45:57terry.reedylinkissue11846 messages
2011-04-25 18:45:57terry.reedycreate