On Sun, Sep 11, 2016 at 9:59 PM, Paul Moore <p.f.mo...@gmail.com> wrote: > # Hacky use of a generator expression: > for i in (x for x in range(10) if x != 5): > body()
This is what I'd like to compare the proposal against. It's perfectly legal but pretty ugly - why should you nest two 'for' loops just for the sake of filtering? > # Functional style > for i in filter(range(10), lambda n: n != 5): > body() And this one is very close (I'd use i instead of n in the lambda function), but still fairly verbose. That said, though, filtered iteration isn't common enough to demand its own syntax IMO. I do it fairly often, but it's usually fine to just have a condition on a separate line. (I do use ": continue" rather than making it two lines.) ChrisA _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/