importing a method

Alex Martelli aleax at mail.comcast.net
Mon Nov 28 11:04:45 EST 2005


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.


Alex



More information about the Python-list mailing list