B
Bruno Desthuilliers
Thomas Heller a écrit :
setattr(cls, name, func) would work better - given that either
isinstance(raw_func, function) or raw_func.__get__ is implemented the
right way.
I'm currently using code like this to create unbound methods
from functions and stick them into classes:
method = new.instancemethod(raw_func, None, cls)
setattr(cls, name, method)
setattr(cls, name, func) would work better - given that either
isinstance(raw_func, function) or raw_func.__get__ is implemented the
right way.