Alex Martelli napisaƂ(a):
>> So another question arise. Is it possible to make function a method (so
>> it will receive calling object as first argument)?
> 
> Sure, impor types then call types.MethodType:
> 
> f = types.MethodType(f, obj, someclass)
> 
> (f.__get__ is also fine for Python-coded functions) -- make sure that
> someclass is obj's class or some ancestor of it, of course.

I wasn't aware of types module. Thanks for your reply.

mk
-- 
 . o .       >>  http://joker.linuxstuff.pl  <<
 . . o   It's easier to get forgiveness for being wrong
 o o o   than forgiveness for being right.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to