On Fri, Sep 25, 2020 at 09:53:41PM +0100, Stefano Borini wrote:
> On Fri, 25 Sep 2020 at 05:55, David Mertz <me...@gnosis.cx> wrote:

> > Smuggling in a generic function calls in square brackets is 
> > undesirable (but obviously not preventable at a language level).  
> > However, I feel like keywords might very often "alter the behavior."
> >
> > For example, imagine we have a distributed array within an engine 
> > that is intended to be "eventually consistent."  I would find code 
> > like this, in some hypothetical library, to be clear and useful, and 
> > not to violate the spirit of indexing.
> >
> >> snapshot1 = remote_array[300:310, 50:60, 30:35, source=worker1]
> >> snapshot2 = remote_array[300:310, 50:60, 30:35, source=worker2]
> 
> I would personally be very uneasy with this. A better solution would
> be to have a proxy object that handles that:
> 
> >> snapshot1 = remote_array.source(worker1)[300:310, 50:60, 30:35]
>
> Of course people can (and will) abuse the feature, but I would
> personally consider it poor design.

Did you just completely undermine the rationale for your own PEP?

Isn't the entire purpose of this PEP to allow subscripts to include 
keyword arguments? And now you are describing it as "poor design"?

For what it's worth, I think David's example is perfectly clear, within 
the spirit of subscripting, and much more understandable to the reader 
than a `.source` method that returns a proxy.

I'm not really sure why this hypothetical call:

    snapshot1 = remote_array[300:310, 50:60, 30:35, source=worker1]

is "abuse" or should make us more uneasy that this hypothetical call:

    snapshot1 = remote_array[300:310, 50:60, 30:35, axis=1]

say. Both cases would change the behaviour in some way. David's example 
specifies the distributed source to use, the second specifies the axis 
to use. Why is the first abuse and the second not?


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

Reply via email to