On Tue, Oct 08, 2019 at 12:55:40PM -0400, Todd wrote:
da.isel(space=0, time=slice(None, 2))[...] = spam
With this syntax this could be changed to:
da[space=0, time=:2] = spam
Anders:
I must have missed something... when did the proposal we're discussing start allowing : there?
Todd:
Why wouldn't it?
Wrong question. New features are not "default accept", we accept them unless there is a strong reason to reject them. They are "default reject", we reject them unless there is a good reason to accept them. So the right question is, why should we accept colons there? This is a proposal for adding keyword args to subscripting, not colon-syntax for slice objects inside arbitrary expressions. If you wish to propose that, you can propose it separately. But for the record, here is one reason why we probably should not allow `time=:2` as syntactic sugar for `time=slice(None, 2)`. 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." 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. -- Steven