Josiah Carlson schrieb: > I would generally agree with you, except that when monkey patching > instances... > self.method = new.instancemethod(other.method.im_func, > self, > self.__class__) > > .... is a bit more understandable than... > self.metbod = type(other.method)(other.method.im_func, > self, > self.__class__) > > .... at least in the examples that I've seen. Never mind that new is > documented in the standard library documentation, but the types are not.
I strongly emphasize on "a bit more". One needs a lot of inside knowledge about internal representation to rebind a method to another instance. The following idea is much easier to understand: self.method = boundmethod(self, method_or_function) Christian _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com