Difference between 'is' and '=='
Terry Reedy
tjreedy at udel.edu
Mon Mar 27 17:17:38 EST 2006
"Clemens Hepper" <ethrandil at gmx.net> wrote in message
news:e08qgg$nt$1 at news2.open-news-network.org...
> It's strange: python seem to cache constants from 0 to 99:
The Python specification allows but does not require such behind-the-scenes
implementation optimization hacks. As released, CPython 2.4 caches -5 to
99, I believe. In 2.5, the upper limit was increased to 256. The limits
are in a pair of #define statements in the int object source file. Anyone
who compiles from source can adjust as desired (though the corresponding
test will fail unless also adjusted ;-).
I think the visibility of this implementation detail from Python code is an
example of a leaky abstraction. For more, see
http://www.joelonsoftware.com/articles/LeakyAbstractions.html
Terry Jan Reedy
More information about the Python-list
mailing list