Reference count

Aahz aahz at pythoncraft.com
Mon Aug 11 18:44:56 EDT 2003


In article <mailman.1060630277.12967.python-list at python.org>,
Pablo Yabo <pyabo at novamens.com> wrote:
>
>I need to keep a object alive even if its reference count if zero.
>Is there any way to increment its reference count using Python code, not
>Py_INCREF or there is any way to avoid deletion of the object?

To expand on Skip and Gary, there is no way to keep alive an object if
its refcount goes to zero.  One way or another, you need to bind *some*
target (most likely a dict or list element) to the object to increase
its refcount.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

This is Python.  We don't care much about theory, except where it intersects 
with useful practice.  --Aahz




More information about the Python-list mailing list