On Tue, Aug 25, 2020 at 09:23:18PM +0100, Stefano Borini wrote:
> There's another option (but I am not endorsing it):
> 
> a[1:2, 2, j=4:7, k=3] means:
> 
> a.__getitem__((slice(1, 2, None), 2, named("j", slice(4, 7, None)),
> named("k", 3)}))

This is not another option, it's just a variant on Jonathan Fine's "key 
object" idea with a new name.


> Where named is an object kind like slice, and it evaluates to the pure
> value, but also has a .name like slice() has .start.

This is contradictory, and not possible in Python without a lot of work, 
if at all. You want `named("k", 3)` to evaluate to 3, but 3 has no `.name` 
attribute. So you can only have one: either `named("k", 3)` evaluates to 
a special key object with a .name attribute "k", or it evaluates to 3. 
Pick one.

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

Reply via email to