On 11 August 2017 at 15:13, Steven D'Aprano <st...@pearwood.info> wrote: > On Fri, Aug 11, 2017 at 02:34:53PM +1000, Nick Coghlan wrote: >> This is another good reason why a termination condition would need to >> be checked before the filter condition rather than either after it, or >> only when the filter condition was true. > > Why is this a problem that needs solving?
Because the most obvious interpretation of a completely independent "while" clause in comprehensions would be as a nested loop inside the outer for loop, not as a nested if-else-break statement. As a result of that, I'm only personally prepared to support for-while comprehensions if they're syntactic sugar for a combined statement level for-while loop that makes it clear why only the "for" clauses in a comprehension create new loops. I *wouldn't* be prepared to support them if they could only be explained in terms of a direct mapping to an if statement and had no statement level counterpart that actually used the "while" keyword. Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/