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

>
>
> On Thu, Aug 20, 2020 at 12:54 PM Jonathan Fine <jfine2...@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.
>> See: https://docs.python.org/3/library/operator.html#operator.itemgetter
>>
>> As I understand it, xarray uses dimension names to slice data.  Here's an
>> example from
>>
>> http://xarray.pydata.org/en/stable/indexing.html#indexing-with-dimension-names
>>     >>> 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.
_______________________________________________
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/GIMNE3JQSQWIR2LLS3ZNGCY7O2K7TT7C/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to