counting references to an instance

Robert Brewer fumanchu at amor.org
Wed Feb 4 14:17:51 EST 2004


Brian wrote:
> Is it possible to get an object to return the number of 
> references there
> are to itself?

Try sys.getrefcount. From the Library Reference:

getrefcount(object)

Return the reference count of the object. The count returned is
generally one higher than you might expect, because it includes the
(temporary) reference as an argument to getrefcount().


HTH

FuManChu




More information about the Python-list mailing list