Terry Reedy wrote:
"Arnaud Delobelle" ... | Thus (3) could be written more simply as: | | (3') [x in L if p(x)]
(x in L) is a legal expression already.
That's the only real issue IMO - and I agree there is no acceptable solution.
(x in L) if p(x) looks like the beginning of (x in L) if p(x) else 'blah' . The whole thing looks like a list literal with an incompletely specified one element.
| This is consistent with common mathematical notation:
'Common mathematical notation' is not codified and varies from writer to writer and even within the work of one writer. Humans make do and make guesses, but parser programs are less flexible.
I guess it also depends on how much math (eg theorem proofs) one had to deal with. FWIW, it took me months to adapt to the correct Python listcomp/genexp syntax, after being bitten dozens of times by Python not accepting Arnaud's (3') form above. The latter was *much* more natural to my fingers. Cheers, BB