Martin v. Löwis wrote:
That's not the full syntax. The full syntax is
[ test for exprlist in testlist list-iter-opt ]
where
test can be an arbitrary expression: and, or, lambda, +, -, ...
exprlist can be a list of expression, except for boolean and
relational expressions (but I think this is
Eric Nieuwland wrote:
Martin v. Löwis wrote:
That's not the full syntax. The full syntax is
[ test for exprlist in testlist list-iter-opt ]
where
test can be an arbitrary expression: and, or, lambda, +, -, ...
exprlist can be a list of expression, except for boolean and
relational expressions
Gareth McCaughan wrote:
I'd like it, and my reason isn't just to save typing.
There are two reasons.
1 Some bit of my brain is convinced that [x in stuff if condition]
is the Right Syntax and keeps making me type it even though
I know it doesn't work.
2 Seeing [x for x in stuff if
On Monday 2005-03-14 12:42, Eric Nieuwland wrote:
Gareth McCaughan wrote:
I'd like it, and my reason isn't just to save typing.
There are two reasons.
1 Some bit of my brain is convinced that [x in stuff if condition]
is the Right Syntax and keeps making me type it even though
[Nick Coghlan]
That 'x in seq' bit still shouts containment to me rather than
iteration, though.
Perhaps repurposing 'from':
(x from seq if f(x))
That rather breaks TOOWTDI though (since it is essentially new syntax
for a for loop). And I have other hopes for the meaning of (x
Nick Coghlan wrote:
That 'x in seq' bit still shouts containment to me rather than
iteration, though.
Perhaps repurposing 'from':
(x from seq if f(x))
That rather breaks TOOWTDI though (since it is essentially new syntax
for a for loop). And I have other hopes for the meaning of (x from ()).
Jim Jewett wrote:
Note that the last x shouldn't have to be x.
[x in seq if f(x)]
is by far my most common syntax error, and
[x for x in seq if f(x)]
is always what I want instead.
That 'x in seq' bit still shouts containment to me rather than iteration,
though.
Perhaps repurposing