[Python-ideas] clear() method for lists

Nick Coghlan ncoghlan at gmail.com
Fri Feb 12 16:45:16 CET 2010


Stephen J. Turnbull wrote:
> This is covered in the manuals, but the gist is that every Python
> object knows how many other objects are pointing to it (called a
> refcount).  When an object's refcount drops to zero, it gets collected
> (immediately, IIRC).

This description applies for CPython (the one from python.org), since
that uses refcounting with cyclic garbage collection. Other Python
implementations work differently (e.g. Jython and IronPython rely on the
garbage collector in their underlying VMs)

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------



More information about the Python-ideas mailing list