On Mon, Aug 31, 2020 at 12:09 AM Greg Ewing <greg.ew...@canterbury.ac.nz>
wrote:

> I'm wondering whether parens should be required when there are both
> keyword args and more than one positional arg in an index. I.e instead
> of
>
>      a[1, 2, k = 3]
>
> you would have to write
>
>      a[(1, 2), k = 3]
>

I think this would be horrible for the poor user who just wants to do
something with an array data structure (e.g. something like xarray) using
three dimensions, only one of which is named.


> That would make it clearer that the indexing syntax still really only
> takes one positional arg, and why, if you transform it into
>
>      idx = (1, 2)
>      a[idx, k = 3]
>
> you don't/can't write it as
>
>      a[*idx, k = 3]
>

This would make things simpler to understand for the implementer, but it's
bad for the user. I'm sure if you ask the xarray implementers they don't
care *how* keywords work as long as their users can write a[1, 2, k=3].

-- 
--Guido van Rossum (python.org/~guido)
*Pronouns: he/him **(why is my pronoun here?)*
<http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-change-the-world/>
_______________________________________________
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/ALLB6BVON6VA6MSTIBG7IQNESD3X5OB3/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to