By the way, this discussion is probably better suited to the 
Python-Ideas mailing list. But since we're here...

On Tue, Nov 09, 2021 at 11:37:40AM +0100, Sebastian Rittau wrote:

> >>To me, the "natural" solution looks like this:
> >>
> >>def foo(x=None, y): ...
[...]

Chris Angelico asked:
> >What would this mean, though:
> >
> >foo(2)
> >
> >Is that legal?
> 
> No. This would be equal to foo(x=2) (same as now), meaning the required 
> argument "y" is missing.

That's an odd interpretation. What you described earlier is very similar 
to the calling convention of range, which conceptually looks like this:

    range([start=0,] end, [step=1])

With your example of "foo(x=None, y)" I would expect foo(2) to mean that 
x gets the default and y gets the passed in argument 2, similar to the 
way that range(2) works.


-- 
Steve
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/S3USWLRSJYLOYMS52UH2YWMFOLTAT7EV/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to