On Mon, Aug 31, 2020 at 1:38 PM Random832 <random...@fastmail.com> wrote: > Another concern is where a new setitem should put the value argument? i may > have missed something mentioning it, but I don't think I've seen a proposal > that goes into detail on that? Having the user define a __setitem__ that > calls the real_setitem if needed gets around that by leaving the signature up > to the user [where they can e.g. put it in a keyword arg with a name they > know they won't need] >
Maybe I'm misreading this, but my understanding is that the definition of the dunder is actually how it's called, not what its signature is. The simplest and most obvious way to do it would be to have the interpreter pass the value positionally, and then keyword arguments separately. You can use whatever name you like for the value, and if you want, you can mandate that it be positional-only: def __setitem__(self, key, value, /, **kw): and then you can accept any arguments you like by keyword, even "self", "key", or "value". This doesn't change the issue of tuplification, but it does mean that the issue is no worse for setitem than for getitem. ChrisA _______________________________________________ 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/PUR2LGVPJHL5JYPSLZ4T2W4VH73KGR62/ Code of Conduct: http://python.org/psf/codeofconduct/