[Python-3000] pep-0362?
Brett Cannon
brett at python.org
Thu Sep 6 22:43:02 CEST 2007
On 9/6/07, Joel Bender <jjb5 at cornell.edu> 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
More information about the Python-3000
mailing list