refcount

Christian Heimes lists at cheimes.de
Tue Jan 29 06:46:15 EST 2008


Simon Pickles wrote:
> Hi,
> 
> Is is possible to access the refcount for an object?
> 
> Ideally, I am looking to see if I have a refcount of 1 before calling del

Help on built-in function getrefcount in module sys:

getrefcount(...)
    getrefcount(object) -> integer

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

Christian




More information about the Python-list mailing list