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. These tricks were discussed in PEP-472 (e.g. specify the unit to be returned), but I always felt uncomfortable with them. -- Kind regards, Stefano Borini _______________________________________________ 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/ZJHMFBANR3FZLYMEAM4XX5LYLGTTMZ3Q/ Code of Conduct: http://python.org/psf/codeofconduct/