On 2020-09-25 20:36, Christopher Barker wrote:
On Fri, Sep 25, 2020 at 6:05 AM Ricky Teachey <ri...@teachey.org <mailto:ri...@teachey.org>> wrote:

    I'd like to hear more about why the empty tuple has been selected as
the default index.

It makes sense to me: if more than one index is passed, they are passed as a tuple. so many classes need to handle tuples anyway.

What other options are there? I suppose None is a possibility, but None is a valid dict key, so probably not a great idea. Hmm, so is an empty tuple. Darn.

I think having no default is a better option, as someone pointed out already in this thread.

It currently doesn't support multiple indexes, so there's no distinction between one index that's a 2-tuple and 2 indexes: d[(1, 2)] == d[1, 2].

Using an empty tuple as the default index isn't that bad, assuming you're going to allow a default.
_______________________________________________
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/MN7MOV4EL5K4MWGGSAKWZYLFZQFTI3Y2/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to