<div class="gmail_quote">On Sat, Oct 17, 2009 at 11:17 AM, Nick Coghlan <span dir="ltr"><<a href="mailto:ncoghlan@gmail.com">ncoghlan@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

The gist is that you split your object into a "core" which requires<br>
finalisation (but can never itself be caught up in a cycle) and the main<br>
object which may participate in cycles. A weak reference to the main<br>
object is placed in a global container. When the weak reference callback<br>
is invoked, the object core is still in a valid state so it can be<br>
finalised safely, even though the main object may be in the midst of<br>
cycle collection.<br>
<br>
This recipe gives a pretty good idea of how that approach works:<br>
<a href="http://code.activestate.com/recipes/519610/" target="_blank">http://code.activestate.com/recipes/519610/</a><br></blockquote></div><br>That idiom (and that recipe in particular! yuck!) is pretty convoluted, IMO.<br>
<blockquote style="margin: 1.5em 0pt;">--<br>
Daniel Stutzbach, Ph.D.<br>
President, <a href="http://stutzbachenterprises.com">Stutzbach Enterprises, LLC</a>
</blockquote>