On Thu, Aug 20, 2020, at 08:56, Random832 wrote:
I have an implementation proposal that I believe is distinct from any of the ones mentioned in the PEP currently.
on further reflection, this seems mostly equivalent to the "kwargs argument" strategy [which I had wrongly read as __getitem__(self, arg, kwargs) instead of __getitem__(self, arg, **kwargs)], except I think the specification that it "should be keyword only" is unnecessary and harmful. I think it would be perfectly reasonable to have a __getitem__(self, idx, option1=None, option2=None) which can be called as d[i, option1=foo] or d[i, option2=bar] - for a class which has a clear distinction between positional and keyword arguments there's no reason to force them to use the wrapper pattern I mentioned in my previous post. Incidentally, "It doesn't preserve order, unless an OrderedDict is used" is out of place since PEP 468 was accepted.