
23 Jul
2018
23 Jul
'18
4:01 p.m.
On 2018-07-23 12:24, Jeroen Demeyer wrote:
Another solution that nobody has mentioned (as far as I know) is to add additional syntax to the language for that. For example, one could say that (1:3) could be used to construct slice(1, 3) directly. The parentheses are required to avoid confusion with type hints. I'm not a Python language expert, but I don't think that type hints can occur inside parentheses like that.
And this could be extended to tuples (1:3, 2:4) and lists [1:3, 2:4] of slices too.