counting references to an instance

Brian balex at sympatico.ca
Wed Feb 4 13:55:02 EST 2004


Hello;

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

Ex:

class test(object):
 pass

a = test()
b = a

# Should print "2", if I knew the name of the method.
print a.refCount()

Many thanks,

Brian.



More information about the Python-list mailing list