about id()...

Moshe Zadka moshez at math.huji.ac.il
Sat Mar 18 23:28:00 CET 2000

On Sat, 18 Mar 2000, Jeff Pinyan wrote:

> Hmm.  Blah:
>   for a in range(150):
>     if id(a) != id(a+0): print a
> gives me numbers from 100 to 149.
> Why is this?  It's some internal magick on Python's part, isn't it...

If a and b are immutables, then it is only guranteed that id(a) == id(b)
implies a == b. Python can do whatever it wants, other then that.

Moshe Zadka <mzadka at geocities.com>. 
http://www.linux.org.il -- we put the penguin in .com

More information about the Python-list mailing list