When I change the class Wrapper to following, the class Foo works:

class Wrapper(object):
        def __init__(self,x):
                self.func_name = x.func_name
                self.x         = weakref.ref(x.im_self)

        def __call__(self,*args,**kwargs):
                x = self.x()
                if x is None:
                        print "lost reference"
                else:
                        return getattr(x,self.func_name)(*args,**kwargs)


But that's ugly. Any better idea?
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to