Roger Binns wrote:
no longer used by any other object? Presumably that object can then be
garbage collected: will the fact that pubsub has a reference to one of its
methods prevent the object from being GC'd, and if not, what happens when an
event is sent to the method?Basically you want the object to go away if pubsub is the only thing with
a reference to it. To do this you need to use weak references. Here
is something from the Python cookbook that shows you how:WeakMethod « Python recipes « ActiveState Code
Arguably pubsub should do this by default.
I've asked Robb S. to work on that but if you have a patch that implemements this change it would certainly help.
I am not too sure why pubsub goes to all the trouble in its makeCallable and parameterCount methods, as they cause all sorts of other issues (eg not recognising an object with __call__ as callable). I don't see why the code doesn't just call the subscriber and let the ordinary type system
raise the appropriate exceptions.
Makes sense to me. Any comments Robb?
···
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!