<p dir="ltr">> It would be<br>
><br>
> for i in (1:10):<br>
> pass</p>
<p dir="ltr">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:</p>
<p dir="ltr">for i in I(1:10):<br>
# do stuff</p>
<p dir="ltr">No change in syntax needed, probably 6 lines in the function definition.</p>
<p dir="ltr">I chose 'I' for Integers, and because it looks small. You could use a different one letter name.<br><br><br></p>
<p dir="ltr">> Anyone who uses sequences should be familiar with this sort of notation:<br>
><br>
> for i in spam[1:10]:<br>
> pass<br>
><br>
> So should have at least some understanding that 1:10 can mean "1 to 10, not including 10".<br>
><br>
> 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.<br>
><br>
><br>
> _______________________________________________<br>
> Python-ideas mailing list<br>
> <a href="mailto:Python-ideas@python.org">Python-ideas@python.org</a><br>
> <a href="https://mail.python.org/mailman/listinfo/python-ideas">https://mail.python.org/mailman/listinfo/python-ideas</a><br>
> Code of Conduct: <a href="http://python.org/psf/codeofconduct/">http://python.org/psf/codeofconduct/</a><br>
</p>