[Python-Dev] PEP 457: Syntax For Positional-Only Parameters (original) (raw)

Eric Snow ericsnowcurrently at gmail.com
Thu Oct 10 00:38:39 CEST 2013


On Wed, Oct 9, 2013 at 12:20 PM, Eric Snow <ericsnowcurrently at gmail.com> wrote:

For me the allure of positional-only arguments lies in the following:

1. not having to roll my own *args handling; 2. not having to clutter up my code with the *args handling; 3. not having to handle positional-or-keyword params with *args when also using positional-only args; 4. documentation and help() can be more clear/accurate. [snip] Regarding help(), getting pydoc to make use of inspect.Signature objects would be great. The idea of supporting optional groups in inspect.Parameter sounds good to me and pydoc could make use of that.

It may work better to facilitate the syntax in this PEP through inspect.Signature and friends, rather than as a pseudo-addition to the Python syntax. Here is some additional API that could help:

These, along with a few other additions, would certainly help address the 4 things I listed above. I have a rough implementation of the above APIs (ignore anything else :) [1].

-eric

[1] https://bitbucket.org/ericsnowcurrently/odds_and_ends/src/default/signature.py



More information about the Python-Dev mailing list