refcount

Benjamin musiccomposition at gmail.com
Tue Jan 29 09:44:27 EST 2008


On Jan 29, 5:46 am, Christian Heimes <li... at cheimes.de> wrote:
> 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().
Are there any cases when it wouldn't?
>
> Christian




More information about the Python-list mailing list