> It would be
>
> for i in (1:10):
>    pass

If you can spare one character you can define a function similar to take that takes a slice object as agreement. Then call it like:

for i in I(1:10):
    # do stuff

No change in syntax needed, probably 6 lines in the function definition.

I chose 'I' for Integers, and because it looks small. You could use a different one letter name.


> Anyone who uses sequences should be familiar with this sort of notation:
>
> for i in spam[1:10]:
>   pass
>
> So should have at least some understanding that 1:10 can mean "1 to 10, not including 10".
>
> I don't see it being any more cryptic than {'a': 1, 'b': 2} meaning dict(a=1, b=2).  On the contrary, I think the dict literal syntax is even more cryptic, since it has no similarity to any other syntax.  The syntax I propose here is at least similar (although not identical) to slicing.
>
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas@python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/