[Python-3000] pep-0362? (original) (raw)
Brett Cannon brett at python.org
Thu Sep 6 22:43:02 CEST 2007
- Previous message: [Python-3000] pep-0362?
- Next message: [Python-3000] pep-0362?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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.imclass 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
- Previous message: [Python-3000] pep-0362?
- Next message: [Python-3000] pep-0362?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]