On Dec 16, 7:54 pm, "James Mills" <prolo...@shortcircuit.net.au> wrote: > @Aaron > > Your code and suggestion is way too complicated. > Just register your objects. When you need to > reload your module, destroy the existing > objects and re-creat them. > > This works well assuming you have a stable > running core that maintains the connection > and that code doesn't change much. > > --JamesMills
The practical and general solutions aren't very similar. Practically, I agree. You could do something generic like reassign __dict__ (like the Borg pattern), or __class__. To be completely general, you'd need an object which passes the type test: "TypeError: unbound method f() must be called with A instance as first argument ( got B instance instead)". Then you could call it in anything, Cls.meth ( obj ), regardless of if you created it before or after the class was created. Or you could have a class that looked up its (posessive) methods' names on a deeper class which could be loaded later: the Delegate, Proxy, or Adapter patterns. Maybe Cls.meth( obj ) should be permitted to work on arbitrary objects by a compiler switch or __future__ import. -- http://mail.python.org/mailman/listinfo/python-list