On Sat, Mar 31, 2018 at 04:48:56PM +0200, Jeroen Demeyer wrote:
> I have prepared a PEP draft for unifying function/method classes. You 
> can find it at
> 
> https://github.com/jdemeyer/PEP-functions
> 
> This has not officially been submitted as PEP yet, I want to hear your 
> comments first.

It seems like a huge amount of work compared to the motivation: allow 
functions written in C to support introspection. Quote:

"In particular, it is currently not possible to implement a function 
efficiently in C (only built-in functions can do that) while still 
allowing introspection like inspect.getfullargspec or 
inspect.getsourcefile (only Python functions can do that)."

Why isn't the answer to provide a hook to support introspection?



In the Subclassing section, you say:

"We disallow subclassing of builtin_function and method to allow fast 
isinstance checks for those types."

Seems to me that if you want a fast, exact (no subclasses) check, you 
should use "type(obj) is Class" rather than isinstance. If the *only* 
reason to prohibit subclassing is to make isinstance a bit faster, 
I don't think that's a good enough reason.




-- 
Steve
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to