[Python-Dev] Positional-only parameters in Python (original) (raw)

Guido van Rossum guido at python.org
Sat Jan 20 00:00:16 EST 2018


On Fri, Jan 19, 2018 at 8:47 PM, Nick Coghlan <ncoghlan at gmail.com> wrote:

On 20 January 2018 at 07:49, Mario Corchero <mariocj89 at gmail.com> wrote: > I am happy to put some work into this (and Pablo Galindo in CC offered to > pair on it) but it is not clear for me whether the next step is drafting a > new PEP or this is just blocked on "re-evaluating" the current one.

I think that would be a question for Larry,

I think you meant for Guido. It's not Larry's language (yet :-).

since there are two main options here:

- proposing just the "/" part of PEP 457 (which allows positional-only arguments, but doesn't allow the expression of all builtin and standard library signatures) - proposing the full PEP 547,

I assume you meant PEP 457 again. :-)

including the "argument groups" feature (which is a bigger change, but allows the expression of signatures like "range([start,] stop, [step,] /)")

One key benefit I'd see to a new subset-of-457 PEP is that it would allow a decision to be made on the basic "/" proposal without deciding one way or the other on whether or not to provide a native way to express signatures like the one for range().

I personally don't think such signatures are common enough to warrant special syntax, and I don't want to encourage them. The few we have (basically range(), slice() and a few functions in the curses module) don't inspire a lot of copy-cat APIs.

OTOH the more plain positional-only arguments are a pretty common need -- for example, for methods that are conventionally used that way, and overridden with disregard for argument names.

(IOW I agree with you here. ;-)

-- --Guido van Rossum (python.org/~guido) -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20180119/289afaf9/attachment.html>



More information about the Python-Dev mailing list