On Sat, Aug 15, 2020 at 7:26 PM Stefano Borini <stefano.bor...@gmail.com>
wrote:

> > QUESTION
> > Suppose we have
> >     >>> d[x=1, y=2] = 42
> >     >>> d[x=1, y=2]
> >     42
> > where d is an instance of a suitable class X that has no special
> knowledge of keywords.
>
> Initially, when I wrote the pep, the idea was that there was no
> distinction of kwargs and normal args. Basically the idea was that
> currently the only "metainfo" associated to every argument is purely
> positional (e.g. the meaning of position 1 is implicit). But index 1
> can have a specific semantic meaning (e.g. it could be a day).
> So in practice they would be one and the same, just that you add
> non-positional semantic meaning to indexes, and you can refer to them
> either through the position, or this additional semantic meaning.
>
> In other words, if you claim that the first index is day, and the
> second index is detector, somehow, there is no difference between
> these
>
> d[3, 4]
> d[day=3, detector=4]
> d[detector=4, day=3]
>
> In fact, my initial feeling would be that you can use either one or
> the other. You should not be able to mix and match.
>
> the pep went through various revisions, and we came to a possible
> proposal, but it's not set in stone.
>

This would definitely not be sufficient for xarray, which I see as being
one of the main users of this syntax.  The whole point is to be able to
specify an arbitrary subset labeled dimensions.
_______________________________________________
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/SJU4YXHOU27CIKPGDKIDJ6EB3H4XR253/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to