> I'd go for val[min:max] tbh.
> benefits:
>
> - currently not allowed!
> - replaces min and max!
Is this a serious suggestion? No offence intended, but this seems
ill-thought-out.
val[min:max] is perfectly legal syntax and it will only error if the variable
val happens to not support indexing.
I would very much welcome this to the standard library as it seems like a
useful function; I certainly would make good use of it and I'm sure others
working with durations use similar code for user-facing parts.
> With a go like parsing it would be:
> >>> datetime.parse_duration("2w50d8h5m27s10m
My suggestion to solve this would be to use a similar rule to the walrus
operator; only allow slice literals within either `()` brackets or `[]` square
brackets; thus `{a: b: c: d, x: y}` becomes illegal and would need to be
`{(a:b): (c:d), x: y}`
___