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

2005-03-15 Thread Martin v. Löwis
Eric Nieuwland wrote: [ test for exprlist in testlist list-iter-opt ] Aren't these names a bit mixed up w.r.t. what's in that position? It comes more-or-less straight out of Grammar/Grammar, so: no, I don't think so. As far as I know test is not a test but a function as it produces any value

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() an d all())

2005-03-14 Thread Batista, Facundo
Title: RE: [Python-Dev] comprehension abbreviation (was: Adding any() and all()) [Gareth McCaughan] #- 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. My brain says: 'x in stuff

Re: [Python-Dev] comprehension abbreviation

2005-03-14 Thread Greg Ewing
Eric Nieuwland wrote: The full syntax is: [ f(x) for x in seq if pred(x) ] being allowed to write 'x' instead of 'identity(x)' is already a shortcut, That's a really strange way of looking at it. Unless you would also say that x = y is a shorthand for x = identity(y) Not that it's false,

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() andall())

2005-03-13 Thread Raymond Hettinger
[GvR] - Before anybody asks, I really do think the reason this is requested at all is really just to save typing; there isn't the avoid double evaluation argument that helped acceptance for assignment operators (+= etc.), and I find redability is actually improved with 'for'. {Neil

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