On 9/6/07, Joel Bender <[EMAIL PROTECTED]> wrote: > > http://www.python.org/dev/peps/pep-0362/ > > > > This would be helpful for boost::python. > > Speaking of helpful... > > class X: > def f(self): pass > > class Y(X): pass > > ...I would like a mechanism to indicate that Y.f is inherited, and I was > hoping that perhaps that information could be found in its signature. I > see that it's not, would it be another PEP to add it? (It was a bit of > an eye opener when I first found out that Y.f.im_class wasn't X.)
Something like this could go into the 'inspect' module (didn't even worry about __slots__):: def find_def(meth): for cls in meth.im_class.mro(): if meth.im_func.__name__ in cls.__dict__: return cls else: return None For such a simple addition to inspect you just need a patch that has a good implementation, thorough unit tests, and a core developer who thinks it is worthwhile enough to add the functionality. -Brett _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com