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?
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.