On Thu, Aug 27, 2020, 19:30 Joseph Martinot-Lagarde <contreba...@gmail.com>
wrote:

> As for foo[a=1, b=2], I'd propose to keep it a SyntaxError for now, and
> always require an index. This way it can be changed later when people are
> more used to the keyword args and have more ideas of what would be good as
> a default argument. In the face of ambiguity, refuse the temptation to
> guess ;)
>

This really wouldn't work for xarray, either.

I think the simplest default value would be Ellipsis.  So foo[a=1, b=2]
would be equivalent to foo[..., a=1, b=2]

But I don't see why this is a problem we have to deal with.  The index
argument can just not be passed at all, and it is up to the class developer
to pick an appropriate sentinel if needed.

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

Reply via email to