On Thu, Aug 20, 2020 at 1:43 PM Sebastian Kreft <skreft@gmail.com> wrote:


On Thu, Aug 20, 2020 at 12:54 PM Jonathan Fine <jfine2358@gmail.com> wrote:
Todd wrote:

It has the same capabilities, the question is whether it has any additional abilities that would justify the added complexity. 

The most obvious additional ability is that always
    >>> d[SOME_EXPRESSION]
is equivalent to
    >>> d[key]
for a suitable key.

This is a capability that we already have, which would sometimes be lost under the scheme you support.  Also lost would be the equivalence between
   >>> val = d[key]
   >>> getter = operator.itemgetter(key)
   >>> val = getter(d)

More exactly, sometimes it wouldn't be possible to find and use a key. Docs would have to be changed.

As I understand it, xarray uses dimension names to slice data.  Here's an example from
    >>> da[dict(space=0, time=slice(None, 2))]

Presumably, this would be replaced by something like
    >>> da[space=0, time=:2]
Was the slicing notation already explicitly proposed for kwargs? I find it too similar to the walrus operator when the first argument is missing.

I could only find an example in this section https://www.python.org/dev/peps/pep-0472/#use-cases, but the first argument is defined.

rain[time=0:12, location=location]

That is something I want to bring up, but I was waiting for the syntax discussion to get settled to avoid derailing it.  I felt it the conversation is already getting pulled in too many directions.