[Tutor] Python cashes low integers? How? Where?

Kalle Svensson kalle at lysator.liu.se
Mon Aug 9 09:59:49 CEST 2004

[Dick Moores]
> If I could ask what seems to be a related question: On p. 85 Chun
> says, "Each object has associated with it a counter that tracks the
> total number of references that exist to that object. This number
> simply indicates how many variables are 'pointing to' any particular
> object."  However, he doesn't say how to find this number. Is there
> a way?

Yes.  The number is called a refcount, and can be read with the
function sys.getrefcount.


More information about the Tutor mailing list