Re: [Python-Dev] comprehension abbreviation (was: Adding any() and all())

2005-03-15 Thread Eric Nieuwland
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

Re: [Python-Dev] comprehension abbreviation (was: Adding any() and all())

2005-03-15 Thread Brett C.
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

Re: [Python-Dev] comprehension abbreviation (was: Adding any() and all())

2005-03-14 Thread Eric Nieuwland
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

Re: [Python-Dev] comprehension abbreviation (was: Adding any() and all())

2005-03-14 Thread Gareth McCaughan
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

Re: [Python-Dev] comprehension abbreviation (was: Adding any() and all())

2005-03-13 Thread Guido van Rossum
[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

Re: [Python-Dev] comprehension abbreviation (was: Adding any() and all())

2005-03-12 Thread Greg Ewing
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 ()).

Re: [Python-Dev] comprehension abbreviation (was: Adding any() and all())

2005-03-11 Thread Nick Coghlan
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