counting references to an instance

Michael Hudson mwh at python.net
Fri Feb 6 06:12:05 EST 2004


"Delaney, Timothy C (Timothy)" <tdelaney at avaya.com> writes:

> > From: Gerrit
> >
> > ...powers of two have a lot more refences, but 17 and 29 have 
> > 2 references
> > more than 18 or 28... interesting.
> > 
> > IIRC, Python keeps references of all small integers,
> > apparantly all smaller than 100.
> 
> Actually -1 through to 99.

Um, this is rank pedantry, but it's -5 to 99...

>>> (0 - 5) is -5
True
>>> (0 - 6) is -6
False

Cheers,
mwh

-- 
  Strangely enough  I saw just such a beast at  the grocery store
  last night. Starbucks sells Javachip. (It's ice cream, but that
  shouldn't be an obstacle for the Java marketing people.)
                                         -- Jeremy Hylton, 29 Apr 1997



More information about the Python-list mailing list