no unbound methods in py3k

Bruno Desthuilliers bdesth.quelquechose at
Wed Oct 8 20:12:49 CEST 2008

Thomas Heller a écrit :
> 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.

More information about the Python-list mailing list