On Thu, Aug 20, 2020 at 11:01 AM Ricky Teachey <ri...@teachey.org> wrote:

> On Thu, Aug 20, 2020 at 10:31 AM Guido van Rossum <gu...@python.org>
> wrote:
>
>>
>>
> That may not be in the PEP, but apart from the edge cases for d[] and
>> d[x=0] it’s exactly what I and Steven have been proposing for quite a while.
>>
>> —Guido
>> --
>> --Guido (mobile)
>>
>
>
I want to offer a big apology if this question has been answered 1 million
> times already. That being said, on the edge case:
>
> d[x=0]
>
> ...what is the alternative proposed __getitem__ call from Guido and Steven?
>

Actually sorry I just answered  my own question-- I guess it depends on
what the call signature is on __getitem__.

If it looked like this:

def __getitem__(self, key=(), **kwargs):
    ...

Then you get () as the key. But if the signature looks like this:

def __getitem__(self, key, **kwargs):
    ...

Then you will get a TypeError.

---
Ricky.

"I've never met a Kentucky man who wasn't either thinking about going home
or actually going home." - Happy Chandler
_______________________________________________
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/R7OV2OQGQKOP23DXLUNRLFEFKXTNFJXQ/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to