On 11.09.2016 22:15, C Anthony Risinger wrote:
On Sep 11, 2016 7:11 AM, "Chris Angelico" <ros...@gmail.com
<mailto:ros...@gmail.com>> wrote:
>
> That said, though, filtered iteration isn't common enough to demand
> its own syntax IMO. I do it fairly often,
I do it often enough to want this.
Same here.
Most of the time it's just a single condition which disturbs the
coherence of the loop body.
When I first started writing Python this struck me as an
inconsistency... if it's useful in comprehensions, why not regular
loops? I realize comprehensions are all about construction of the list
itself, but the parallel still exists.
Also feels similar to guard statements. I'd love to see Python gain
more pattern matching and destructuring features because they are
wonderful in Erlang/Elixir.
> but it's usually fine to
> just have a condition on a separate line. (I do use ": continue"
> rather than making it two lines.)
FWIW, code I write or review would mandate this be two lines followed
by a blank line, so 3 total. I require any abrupt change or
termination in the current flow of control to be followed by a blank
line so the reader clearly sees the possible jump (continue, break,
and return especially).
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/