On Wed, Aug 26, 2020 at 10:10:34AM -0400, Ricky Teachey wrote:

> But I have to say that I think this latest is a fantastic idea, and when
> Jonathan presented it to me it was very surprising that I had not seen it
> presented by anyone else yet. I think it solves a ton of problems,

Such as?


> adds a huge amount of flexibility and functionality,

Such as?


> With the proposal, the language would support any function desired to turn
> the "stuff" inside a subscripting operation into the item dunder calls.

I'm sorry, I don't understand that sentence.


> For example: if this proposal were already in place and PEP 472 were to
> continue to be held up because of terrorists like me ;) *, one could have
> written this translation function and PEP-472-ify their classes already:
> 
> def yay_kwargs(self, *args, **kwargs):
>     return self.__getitem__(args, **kwargs)

You're calling the `__getitem__` dunder with arbitrary keyword 
arguments. Are you the same Ricky Teachey who just suggested that we 
should be free to break code that uses `__getitem__` methods that don't 
obey the intent that they have only a single parameter and no keywords?

If PEP 472 is held up, then `obj[1, 2, axis='north']` is a SyntaxError, 
so how does this method yay_kwargs make it legal?



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

Reply via email to