On Wed, May 15, 2019 at 1:37 AM Anders Hovmöller <[email protected]> wrote:
>
> > On 15 May 2019, at 03:07, Robert Vanden Eynde <[email protected]> wrote:
> >
> > Currently if one wants to provide positional arguments after keyword 
> > arguments, it's not possible, one must begin with positional arguments [1] 
> > or use keyword arguments [2] :
>
> I'm my opinion the goal should be that there is no such thing as positional 
> only arguments in python. It's just a bad idea. No r al arguments that can be 
> both positional or keyword at the call site, or keyword only. Those are good 
> and make sense. Adding a third option is just added complexity.

That's not a realistic goal; there are some use cases, including in
CPython builtins, that cannot be accomplished without positional-only
arguments. For example, the current behavior of the `dict` constructor
is to accept both certain iterables as a positional-only argument
and/or keyword arguments from which a dict can be created. If the
iterable argument was not positional-only, then it would be forced to
consume a keyword (even if the caller passes it as a positional
argument), meaning that that keyword could never be included in
**kwargs and could not become a dict key via keyword arguments.

Additionally, PEP 570 [1], which will add syntax for positional-only
parameters in Python functions, was accepted by Guido last month.

[1] https://www.python.org/dev/peps/pep-0570/
_______________________________________________
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to