
I'd like to hear more about why the empty tuple has been selected as the default index. On Fri, Sep 25, 2020, 1:07 AM David Mertz <mertz@gnosis.cx> 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.
-- The dead increasingly dominate and strangle both the living and the not-yet born. Vampiric capital and undead corporate persons abuse the lives and control the thoughts of homo faber. Ideas, once born, become abortifacients against new conceptions. _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-leave@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/65KCDF... Code of Conduct: http://python.org/psf/codeofconduct/