importing a method
ggrp1.20.martineau at dfgh.net
Mon Nov 28 17:43:31 CET 2005
I'd like to point out to the OP that using a function's __get__ method
this way only works with new-style classes and their instances...not
with the example in the shown in original post.
Alex Martelli wrote:
> Flavio <fccoelho at gmail.com> wrote:
> > This "new" module sounds pretty cool, too bad its deprecated...
> > I would not want to add a dependancy to a deprecated module in my code.
> > But maybe I'll check the code for instancemethod within it and see what
> > it does.
> If you have a function f and want to make an instancemethod out of it,
> you can simply call f.__get__(theinstance, theclass) and that will build
> and return the new instancemethod you require.
More information about the Python-list