M
Mel Wilson
Roger said:Steve R. Hastings wrote:
Is this guaranteed by the Python specification, or is it an artifact of
the current implementation?
AFAIK it's an artifact. The performance hit it Python
stopped sharing small integers could be enormous,
nonetheless sharing isn't part of the specification
I agree. "is" is for working with linked-lists or trees, orMy understanding has been that an
implementation is free to share integer objects or not, so using 'is'
as an equality test takes you into undefined territory, regardless of
the size of the value.
other applications where object identity is really and truly
what you're interested in.
Some amusing is/== facts, some suggested by recent threads
Python 2.4.2 (#1, Jan 23 2006, 21:24:54)
[GCC 3.3.4] on linux2
Type "help", "copyright", "credits" or "license" for more
information.False