
Andrey Popp <8mayday@gmail.com> writes:
Reading discussion on python-ideas about "Accessing the result of comprehension's expression from the conditional", I've came to the idea of where clauses, similar to Haskell's.
This solves the problem of recalculating of value multiple times. For example, in the following expression:
[(f(x), f(x)) for x in some_iterable if f(x) < 2]
New syntax isn't necessary to solve the above stated problem. For example, the following existing syntax is also a solution:: [(y, y) for y in (f(x) for x in some_iterable) if y < 2] For the proposed new syntax to be accepted, it would need to be somehow significantly superior to the existing syntax. Can you demonstrate how it's superior? -- \ “I took a course in speed waiting. Now I can wait an hour in | `\ only ten minutes.” —Steven Wright | _o__) | Ben Finney