is and ==
Mark Jackson
mjackson at wc.eso.mc.xerox.com
Mon Feb 26 13:20:10 EST 2001
"Dave Brueck" <dbrueck at edgix.com> writes:
> The interpreter "caches" integer objects from something like -1 to 100, so
> 'is' evaluates to true for low integers but not higher integers.
>
> (Also, as the docs point out, this caching means that from inside an
> extension module you could _redefine_ the value of the integer object 5, for
> example:
>
> >>> evilext.causehavoc(5,10) # sets '5' object to have int value of 10
> >>> 5 + 5
> 20 # Whee!!!
Woah. Fortran flashbacks. . .
--
Mark Jackson - http://www.alumni.caltech.edu/~mjackson
Having your book made into a movie is like having
your ox made into a bouillon cube.
- Bill Neely
More information about the Python-list
mailing list