Hi,
I've recently found myself writing code similar to this:
for i in range(10):
if i == 5:
continue
"body"
which I find a bit ugly. Obviously the same could be written as
for i in range(10):
if i != 5:
"body"
but here you would have to look at the end of the body to see if
something happens when i==5.
So I asked myself if a syntax as follows would be possible:
for i in range(10) if i != 5:
body
Personally, I find this extremely intuitive since this kind of
if-statement is already present in list comprehensions.
What is your opinion on this? Sorry if this has been discussed before --
I didn't find anything in the archives.
Best regards,
Dominik Gresch
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/