On 3/31/2018 12:09 PM, Steven D'Aprano wrote:
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.signature, which superceded .getfullargspec, works with C-coded functions that use ArgumentClinic.

>>> inspect.signature(list)
<Signature (iterable=(), /)>
>>> inspect.signature(list.append)
<Signature (self, object, /)>
>>> inspect.signature(int)  # fails

I would be all for more of the builtins and stdlib being converted.
Can't 3rd-party C code use ArgumentClinic?

inspect.getsourcefile (only Python functions can do that)."

Sourcefile is meaningless when there is no source file. C sources would be far less useful than Python sources.

--
Terry Jan Reedy

_______________________________________________
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