[Python-ideas] Re: Add builtin function for min(max())

2020-07-03 Thread TCPhone93
> 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.

[Python-ideas] Re: Add parse_duration to datetime - a golang like fucntion to parse duration

2020-08-22 Thread tcphone93
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

[Python-ideas] Re: PEP 472 - slices in keyword indices, d[x=1:3]

2020-08-26 Thread tcphone93
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}` ___