![](https://secure.gravatar.com/avatar/7e41acaa8f6a0e0f5a7c645e93add55a.jpg?s=120&d=mm&r=g)
From: David Mertz <mertz@gnosis.cx> Sent: Monday, July 1, 2013 1:29 PM
On Mon, Jul 1, 2013 at 10:25 AM, Joshua Landau <joshua.landau.ws@gmail.com> wrote:
primes100 = {p for p in primes(); break if p >= 100} primes100 = {p for p in primes() while p < 100}
If you're telling me that "{p for p in primes() while p < 100}" reads better than "{p for p in primes(); break if p >= 100}" I have to disagree strongly. The "break if" form looks beautiful.
My own taste is in strong contrast to Joshua's. I think the semi-colon/break-if looks absolutely horrendous and ugly. The 'while' clause looks obvious, beautiful, and intuitive.
It isn't really that the semicolon is inherently ugly, but that it doesn't fit in with today's comprehension syntax. And the problem we're running into here is that, given today's comprehension syntax, there simply _is_ no clear way to extend it any further. Consider that if you try to translate a non-trivial comprehension into English, it's going to have at least commas in it, and likely semicolons. Also, consider that you really never want to nest arbitrary clauses; you just want to nest loops, and attach modifiers to them. So… Haskell-style comprehensions, as we have today, can only be taken so far. But I don't think that's a problem. See http://stupidpythonideas.blogspot.com/2013/07/syntactic-takewhile.html for more details and ramblings.