Michal Kwiatkowski <[EMAIL PROTECTED]> wrote:

> 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.


Alex


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

Reply via email to