Bill Mill <[EMAIL PROTECTED]> wrote:
   ...
> > class Test:
> >     def __init__(self, method):
> >         self.m = new.instancemethod(method, self, Test)
> 
> Beautiful! thank you very much. Looking into the "new" module in
> python 2.4, that's equivalent to:
> 
> self.m = type(self.__init__)(method, self, Test)

Another approach with the same result is to exploit the fact that a
function is a descriptor:

self.m = method.__get__(self, Test)


Alex
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to