On Tue, Sep 01, 2020 at 09:04:31AM -0700, Christopher Barker wrote: > The set case is non-trival (which you do discuss later), but could you > provide an example or two here as well? > > I think: > > obj[foo, bar, spam=1, eggs=2] = a_value > # calls type(obj).__getitem__((foo, bar), a_value, spam=1, eggs=2) > > Is that right? good to lay it out.
Yes, that's what I had in mind. > The setitem case is particularly awkward, but fortunately, only for the > writers of classes that use these features, not the users of those classes. > So manageable complexity. There is unfortunately no interpreter support for making an earlier parameter optional while a later one is mandatory (like the range builtin). We can write this signature: range(start=0, end, step=1) but we can't implement it directly.. > I like your gotchas section -- and we do want to have this well documented, > along with the "best practices" that you suggest. Thank you. -- Steve _______________________________________________ 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/HUBBARLPIT3N2HSQSTPFARUYUQGUVIRM/ Code of Conduct: http://python.org/psf/codeofconduct/