Chris Angelico writes:

 > What Python needs is a non-clunky way to express [filtered iteration].

I don't.  In my own code there aren't any else-less cases of for: if:.
All the filtered iterations have intervening code at the top of the
loop before the if.  Most could be refactored to use filtered
iteration, but it would come at a cost in readability because the
filters are moderately complex expressions, the auxiliaries used in
the filter condition have meaningful names in the problem domain.
Also, the auxiliaries are sometimes used in the loop body.

But if somebody's willing to do the spade work to show that filtered
iteration would clarify a fair number of loops in a substantial
existing corpus, I'll be happy to overcome my aversion to new syntax
and get behind it for those who do need it.

Steve

_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/LLBW5GEZQM67JBF4WVVEN6YGKCLAWEEL/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to