about id()...

Gordon McMillan gmcm at hypernet.com
Sat Mar 18 15:08:38 EST 2000


Jeff Pinyan talks to himself...

> 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...

Yep. The ints < 100 are interned. The fact that the limit is not 
256 says something interesting about Guido...

- Gordon




More information about the Python-list mailing list