[Python-Dev] Combining the best of PEP 288 and PEP 325: generator exceptions and cleanup

Phillip J. Eby pje at telecommunity.com
Thu May 19 20:27:08 CEST 2005


At 07:18 PM 5/19/2005 +0100, Michael Hudson wrote:
>"Phillip J. Eby" <pje at telecommunity.com> writes:
>
> > However, Tim's new post brings up a different issue: if the collector 
> can't
> > tell the difference between a cycle participant and an object that's only
> > reachable from a cycle,
>
>Uh, that's not what he meant:
>
>/>> class C:
>|..  def __del__(self):
>|..   print 'bye'
>\__
>->> a = [C()]
>->> a.append(a)
>->> del a
>->> gc.collect()
>bye
>1

Now you've shaken my faith in Uncle Timmy.  :)  Seriously, he did *say*:

"""For example, it doesn't know the difference between an object
that's in a trash cycle, and an object that's not in a trash cycle but
is reachable only from trash cycles."""

So now I wonder what he *did* mean.



More information about the Python-Dev mailing list