Surprise using the 'is' operator

wesley chun wescpy at gmail.com
Tue Sep 26 15:39:50 EDT 2006


as a side note, the ints that are cached (for current versions of
Python) are in range(-1, 100)... is this documented somewhere? i know
it's subject to change.  and as already mentioned, you probably
wouldn't use "is" this way in real code... i know you are just
reinforcing your learning of the difference between object *value*
comparison vs. object *identity* comparison. what you've discovered,
however, is important in learning Python... i have material in my
intro course and the book dedicated to this subject.

cheers,
-- wesley
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"Core Python Programming", Prentice Hall, (c)2007,2001
    http://corepython.com

wesley.j.chun :: wescpy-at-gmail.com
python training and technical consulting
cyberweb.consulting : silicon valley, ca
http://cyberwebconsulting.com



More information about the Python-list mailing list