On Tue, Oct 8, 2019, at 13:57, Steven D'Aprano wrote: > It is confusing as hell. When I saw this > > da[space=0, time=:2] > > I read it as a slice: > > da[ slice( (space=0, time=), 2, None) ] > > and thought "That must be a typo, because the time keyword > doesn't have a value."
Do you read [0,:2] as slice((0,), 2) as well? Is [0:1, 2:3] slice(0, (1, 2), 3) or (slice(0, 1), slice(2, 3))? [it is the latter.] Slices are already allowed within subscripting, and already have higher precedence than comma. > And combining slice syntax with keywords in the same call is a recipe > for over-complicated, confusing subscripts, which is why Caleb initially > suggested you can use one, or the other, but not both. I'm not sure the topic of slice syntax had been mentioned yet... as I recall it, what Caleb suggested was that you couldn't use positional arguments and keyword arguments in the same call. Incidentally, I don't agree with the reasoning there - principle of least surprise suggests making the rules as close to function call syntax as possible, with the exception that values can be slices. _______________________________________________ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/[email protected]/message/QRH6SOLPYS4XNVKTCUTLUJGQWVOT2JHO/ Code of Conduct: http://python.org/psf/codeofconduct/
