[Python-3000] removing functions from string module
lists at cheimes.de
Wed Apr 18 03:49:16 CEST 2007
Josiah Carlson schrieb:
> I would generally agree with you, except that when monkey patching
> self.method = new.instancemethod(other.method.im_func,
> .... is a bit more understandable than...
> self.metbod = type(other.method)(other.method.im_func,
> .... 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)
More information about the Python-3000