Hi Miles, Miles Kaufmann <mile...@umich.edu> writes: > You could also create a wrapper object that holds a weak reference to the > instance and creates a bound method on demand: > class WeakMethod(object): > def __init__(self, bound_method): > self.im_func = bound_method.im_func > self.im_self = weakref.ref(bound_method.im_self) > self.im_class = bound_method.im_class
In this case, I can use it only for bound methods, so I would need to handle the case of unbound methods separately. Is there a way to find out whether a function is bound? Or do I have to use hasattr(im_func) and hasattr(im_self) and hasattr(im_class)? Best regards Ole -- http://mail.python.org/mailman/listinfo/python-list