[Python-Dev] signature.object, argument clinic and grouped parameters

Nick Coghlan ncoghlan at gmail.com
Tue Jan 21 00:09:53 CET 2014


On 21 Jan 2014 06:26, "Terry Reedy" <tjreedy at udel.edu> wrote:
>
> On 1/20/2014 7:59 AM, Nick Coghlan wrote:
>
>> However, while I know you're keen to finally make introspection work
>> for all C level callables in 3.4, even the ones with signatures that
>> can't be expressed as Python function signatures, I'd like to strongly
>> encourage you to hold off on that last part until Python 3.5.
>
> ...
>
>> That way, you can resurrect PEP 457, recast it as proposing an
>> *output* format for inspect.Signature.__repr__(), add an
>> inspect.Signature.fromstr() API that can use it to create a signature
>> object from __text_signature__ attributes (rather than relying on
>> ast.parse), add the optional group support and do it *right*, rather
>> than trying to squeeze it in as a new public API during the beta
>> period, which may lock us in to supporting an introspection API we
>> later regret.
>
>
> I agree. What we can do with the API we have already is a great advance.

It also occurred to me last night that PEP 457 could define a
"functools.textsignature" decorator to permit describing a particular
signature on arbitrary callables (using the attribute already added for
Argument Clinic, but extended to arbitrary types). That would allow
signature overrides without needing to import the inspect module at startup.

Cheers,
Nick.

>
> --
> Terry Jan Reedy
>
>
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
https://mail.python.org/mailman/options/python-dev/ncoghlan%40gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20140121/0077f23b/attachment-0001.html>


More information about the Python-Dev mailing list