On Tue, Aug 2, 2011 at 8:24 AM, Jim Bosch <talljimbo@gmail.com> wrote:
Hmm. That might mean you need to do a big design change; while it often works, one really isn't supposed to rely on __del__ being called when a Python object first could be garbage-collected - when cycles are involved, Python doesn't even guarantee that it will ever call __del__. It sounds like you'd be much better off with a named destructor-like method that would be called explicitly when you want to remove an object from the game.
I am aware of that. :) Still, I'd like to leave it only as a last resort, I don't like complicating the API (who does? :P ). If I get rid of the strong reference that the `EventManager` has over the callback, there will be no cycles. My dependency graph would look something like this: ► http://i.imgur.com/wkxUn.jpg