'==' vs. 'is' behavior
Oleg Broytmann
phd at phd.russ.ru
Fri Nov 12 10:28:48 EST 1999
On Fri, 12 Nov 1999, Andy Fox wrote:
> >>> a is b #are they the same object? yes. Why?
> 1
>
> Further experimentation shows that this seems to work for integers
> through 99, but that starting with 100 the results of the 'is' test
> return 0, as I would expect.
I believe intergers 0 through 99 are preallocated by Python interpreter
to speed up common things like "x = y + 12".
Oleg.
----
Oleg Broytmann Foundation for Effective Policies phd at phd.russ.ru
Programmers don't die, they just GOSUB without RETURN.
More information about the Python-list
mailing list