
On Fri, Jun 19, 2009 at 3:39 AM, Lie Ryan<lie.1296@gmail.com> wrote:
res = [x**x as F for x in nums if F < 100]
This, I have wanted. That doesn't resolve all the issues others raised, but (at least for me), you just moved it from "a little worse than the status quo" to "hmm... that would be nice if it could be done without too many side effect on the rest of the language." On the possibility that a more general problem sometimes spurs a more elegant solution, I'll point out that I have more often wanted access to the previous or following element, and that my desired filters on the results are often reliant on the results-so-far.
Disadvantages: - reverses the current semantic of filtering-then-expression.
For What Its Worth, I'm not sure how strong that argument should be. Is this just a bizarre corner case, or is there lots of code that relies on it? That ordering actually surprises me, because I expect python to evaluate left to right. On the other hand, now that we have conditional expressions, consistency with those is probably more important, so maybe the number of people surprised by the current situation will go down with time. -jJ