new.instancemethod and new style classes
Mark McEahern
mark at mceahern.com
Tue Jan 22 02:17:11 EST 2002
The instancemethod of the new module does not work with new style classes:
import new
class fooOld:pass
class foo(object):pass
def bar(self):
print "foobar"
fooOld.bar = new.instancemethod(bar, None, fooOld)
foo.bar = new.instancemethod(bar, None, foo)
The last line generates this error:
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: instancemethod() argument 3 must be class, not type
Is this by design?
Thanks,
// mark
More information about the Python-list
mailing list