> -----Original Message-----
> From: python-dev-bounces+kristjan=ccpgames....@python.org
> [mailto:python-dev-bounces+kristjan=ccpgames....@python.org] On Behalf
> Of Greg Ewing
> Sent: 8. desember 2009 22:09
> To: python-dev@python.org
> Subject: Re: [Python-Dev] recursive closures - reference cycle
> 
> You could use a class:

Yes, and a number of different workarounds.  That's not really the issue.  The 
issue is that what looks like a perfectly safe idiom (calling a function 
recursively) happens to create a reference cycle if that function is a closure.
This is a non-obvious "gotcha" that I must now educate my team about.

Note that at least parts of the library strive to avoid reference cycles even 
though "gc" exists.  An example being xlm.minidom.Document.unlink()

Cheers,

Kristján

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to