On Thu, Aug 20, 2020 at 9:16 PM Random832 <random832@fastmail.com> wrote:
On Thu, Aug 20, 2020, at 20:09, Steven D'Aprano wrote:
> This is likely to be a rare and unusual case, but we don't want to break
> anyone who already has a dunder something like this:
>     def __getitem__(self, index, extra=None)

People do similar things with regular arguments to regular functions now, trusting callers not to pass stuff in for no reason that will break the function has been adequate there.

Yes, but this is a little different in that the [] operator will never pass in anything else, but if we make this change, then it might -- so this is a breaking change in this case. And having keywords in the square brackets pass keyword args to the dunder could,m in fact break this use case, whereas passing a new keyword_index object would not.

But as I said in an earlier note -- having ezra keyword parameters on __getitem__ is an abuse of the system anyway, so I think it's OK to break that.


Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-leave@python.org
Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/XYYOGRZ673D4S7YLGGZBMB6QJ4CXNC3U/
Code of Conduct: http://python.org/psf/codeofconduct/

Christopher Barker, PhD

Python Language Consulting
  - Teaching
  - Scientific Software Development
  - Desktop GUI and Web Development
  - wxPython, numpy, scipy, Cython