
On 2020-09-25 20:36, Christopher Barker wrote:
On Fri, Sep 25, 2020 at 6:05 AM Ricky Teachey <ricky@teachey.org <mailto:ricky@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.