Eric Nieuwland wrote:
[ for in ]
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
is not a test but a function as it produces any value not just
True/False
To quote more of
Eric Nieuwland wrote:
Martin v. Löwis wrote:
That's not the full syntax. The full syntax is
[ for in ]
where
can be an arbitrary expression: and, or, lambda, +, -, ...
can be a list of expression, except for boolean and
relational expressions (but I think this is further constrained
seman
Martin v. Löwis wrote:
That's not the full syntax. The full syntax is
[ for in ]
where
can be an arbitrary expression: and, or, lambda, +, -, ...
can be a list of expression, except for boolean and
relational expressions (but I think this is further constrained
semantically)
list a list
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, just as dropping the conditional part.
That's not the full syntax. The full syntax is
[ for in ]
where
can be an arbitrary expression:
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,
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
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
On Monday 2005-03-14 12:09, Alex Martelli wrote:
>
> On Mar 14, 2005, at 10:57, Gareth McCaughan wrote:
>
> > of way as it's distracting in C or C++ seeing
> >
> > Thing thing = new Thing();
> >
> > with the type name appearing three times.
>
> I think you can't possibly see this
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 con
On Mar 14, 2005, at 10:57, Gareth McCaughan wrote:
of way as it's distracting in C or C++ seeing
Thing thing = new Thing();
with the type name appearing three times.
I think you can't possibly see this in C:-), you need a star there in
C++, and you need to avoid the 'new' (just cal
> - 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'.
I'd like it, and
[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'.
{Ne
Guido van Rossum:
> - 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'.
[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
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 '
16 matches
Mail list logo