watching the number of references to an object
mwh at python.net
Thu Feb 14 17:02:45 CET 2002
"Paul Brian" <paul1brian at yahoo.com> writes:
> Dear all,
> Does anyone know how to monitor the references pointing to an instance of an
> the gc module (according to docs) seems to show those with no
> references left, but I am interested in seeing how many refs a given
> instance has...any ideas on back of a postcard please
You want gc.get_referrers (new in 2.2, I think), or maybe just
>>> import gc
(the referrers are going to be sys.modules & __main__.__dict__ here).
at any rate, I'm satisfied that not only do they know which end of
the pointy thing to hold, but where to poke it for maximum effect.
-- Eric The Read, asr, on google.com
More information about the Python-list