On Sat, 26 Sep 2020 at 04:02, Steven D'Aprano <st...@pearwood.info> wrote:
> 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"? Not really. to _me_, an indexing operation remains an indexing operation. My personal use cases are two: 1. naming axes (e.g. replace, if desired obj[1, 2] with obj[row=1, col=2]) 2. typing generics MyType[T=int] Other use cases are certainly allowed, but to me, something like a[1, 2, unit="meters"] makes me feel uncomfortable, although I might learn to accept it. In particular, the above case becomes kind of odd when you use it for setitem and delitem a[1, 2, unit="meters"] = 3 what does this mean? convert 3 to meters and store the value in a? Then why isn't the unit close to 3, as in a[1,2] = 3 * meters and what about this one? del a[1, 2, unit="meters"] # and this one? I feel that, for some of those use cases (like the source one), there's a well established, traditional design pattern that fits it "better" (as it, it feels "right", "more familiar") > 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: I don't know... it just doesn't feel... "right" :) but maybe there's a logic to it. You are indexing on the indexes, and also on the source. Yeah, makes sense. Sold. -- 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/IUGWBNNFF275HVRNDRJ2RWR53ZJYMPBN/ Code of Conduct: http://python.org/psf/codeofconduct/