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. _______________________________________________ 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/MNEAYBTOSXKY6RTOEM3GK7RUQADGPEOK/ Code of Conduct: http://python.org/psf/codeofconduct/