Tuesday, June 12, 2012

finding methods from parent classes in python

instanceName.methodName.im_func.func_code
or
instanceName.methodName.im_func.__code__

i always forget how i can find out where a method is defined if it comes from somewhere up the inheritance tree. maybe there's a better way, but the special attrs above will at least give me the file and line number.

No comments: