[issue31939] Support return annotation in signature for Argument Clinic

Serhiy Storchaka report at bugs.python.org
Sat Nov 4 09:27:13 EDT 2017


Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:

Argument Clinic doesn't have any relations to annotations. It is just by accident use the syntax similar to the syntax  of annotations in its declarations (and actually use Python parser for parsing them as anotations, but this is an implementation detail). It doesn't set argument annotations in signatures.

For example, chr() is declared with:

/*[clinic input]
chr as builtin_chr

    i: int
    /

Return a Unicode string of one character with ordinal i; 0 <= i <= 0x10ffff.
[clinic start generated code]*/

Argument Clinic generates:

PyDoc_STRVAR(builtin_chr__doc__,
"chr($module, i, /)\n"
"--\n"
"\n"
"Return a Unicode string of one character with ordinal i; 0 <= i <= 0x10ffff.");

I think it could be possible to make Argument Clinic generating argument annotations basing on the accepted by converters types, but we are far from this.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue31939>
_______________________________________


More information about the Python-bugs-list mailing list