[Python-ideas] slice[] to get more complex slices

Jeroen Demeyer J.Demeyer at UGent.be
Mon Jul 23 06:31:06 EDT 2018


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.


More information about the Python-ideas mailing list