<div dir="ltr">for i in range(...) is *sometimes* indicative of code smell, especially when then doing x[i], though it has its uses. I've never had a need to shorten a for...range line though.<div><br></div><div>Other than it being "cute", do you have an example where it's definitively better?</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Feb 14, 2017 at 4:03 PM, Todd <span dir="ltr"><<a href="mailto:toddrjen@gmail.com" target="_blank">toddrjen@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div class="h5">On Tue, Feb 14, 2017 at 4:41 PM, MRAB <span dir="ltr"><<a href="mailto:python@mrabarnett.plus.com" target="_blank">python@mrabarnett.plus.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="m_-6300227146772033567HOEnZb"><div class="m_-6300227146772033567h5">On 2017-02-14 21:09, Zachary Ware wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Tue, Feb 14, 2017 at 3:06 PM, Mikhail V <<a href="mailto:mikhailwas@gmail.com" target="_blank">mikhailwas@gmail.com</a>> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I have a small syntax idea.<br>
In short, contraction of<br>
<br>
for x in range(a,b,c) :<br>
<br>
to<br>
<br>
for x in a,b,c :<br>
<br>
I really think there is something cute in it.<br>
So like a shortcut for range() which works only in for-in statement.<br>
So from syntactical POV, do you find it nice syntax?<br>
Visually it seems to me less bulky than range().<br>
<br>
Example:<br>
<br>
for x in 0,5 :<br>
print (x)<br>
for y in 0,10,2 :<br>
print (y)<br>
for z in 0, y+8 :<br>
print (z)<br>
</blockquote>
<br>
This is already valid and useful syntax, and thus a non-starter.<br>
<br>
>>> for x in 0,5 :<br>
... print (x)<br>
... for y in 0,10,2 :<br>
... print (y)<br>
... for z in 0, y+8 :<br>
... print (z)<br>
...<br>
0<br>
0<br>
0<br>
8<br>
10<br>
0<br>
18<br>
2<br>
0<br>
10<br>
5<br>
0<br>
0<br>
8<br>
10<br>
0<br>
18<br>
2<br>
0<br>
10<br>
<br>
</blockquote></div></div>
The closest you could get without breaking existing code is [a:b:c]:<br>
<br>
for x in [0:5]:<br>
print(x)<br>
for y in [0:10:2]:<br>
print(y)<br>
for z in [0:y+8]:<br>
print(z)<br>
<br>
What's more, that could be valid outside the 'for' loop too.<br><br></blockquote><div><br></div></div></div><div>Guido has already rejected this syntax and several others. <br></div></div></div></div>
<br>______________________________<wbr>_________________<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" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" rel="noreferrer" target="_blank">http://python.org/psf/<wbr>codeofconduct/</a><br></blockquote></div><br></div>