[Python-ideas] PEP draft: Unifying function/method classes

Steven D'Aprano steve at pearwood.info
Sat Mar 31 20:57:22 EDT 2018


On Sat, Mar 31, 2018 at 06:58:19PM +0200, Jeroen Demeyer wrote:
> On 2018-03-31 18:09, Steven D'Aprano wrote:
> >It seems like a huge amount of work
> 
> What is a huge amount of work? Writing the PEP? Implementing the PEP? 
> Using the PEP? Adapting existing Python code to the PEP?

Any or all of the above.
 

> >Why isn't the answer to provide a hook to support introspection?
> 
> That is a lot easier said than done. How would you do that?

I wouldn't :-)

But your PEP should cover the reason why that solution is either not 
possible, not satisfactory, or even more work than what you are 
proposing. In other words, your PEP should at least identify alternative 
solutions that solve the same problems, and give reasons why your 
solution should be preferred.


[...]
> Do you happen to know why the existing function classes in Python 
> disallow subclassing? I assumed that it was for exactly this reason.

No idea. A couple of times I've tried to subclass FunctionType and that 
has bit me.


-- 
Steve


More information about the Python-ideas mailing list