
Quoting levels are a bit messed up in David's post, I've tried to fix them bu apologies if I'm attributing words to David that he didn't write. On Thu, Sep 24, 2020 at 07:04:31PM -1000, David Mertz wrote:
Is this a breaking change? It feels borderline.
Keyword-only subscripts are permitted. The positional index will be the empty tuple:
obj[spam=1, eggs=2] # calls type(obj).__getitem__(obj, (), spam=1, eggs=2)
I.e. consider:
d = dict() d[()] = "foo" d {(): 'foo'}
I don't really object to this fact, and one could argue it's not a breaking change since a built-in dict will simply raise an exception with keyword arguments. However, it does make the empty tuple the "default key" for new objects that will accept keyword indices.
I agree with Ricky that the choice of empty tuple should be justified better by the PEP, and alternatives (None, NotImplemented) discussed. But I don't think this is a breaking change. Can you explain further what you think will break? -- Steve