any() and all() shorthand
castironpi at gmail.com
castironpi at gmail.com
Mon Jan 7 23:26:28 EST 2008
> print 'lookahead2(initial=3.14159, last=42)'
> for this, next in lookahead2([1,2,3,4,5],
> initial=3.14159, last=42):
> print this, next
No, actually. But my mistake.
[ a.b() or _previous_ for a in c ]
means
1 or 2 or 3 or 4 or 5
where c= [ 1, 2, 3, 4, 5].
The mistake: this was not a list comprehension; I wanted to reduce to
a single value.
It's equivalent to reduce( operator.or_, [ 1, 2, 3, 4, 5 ] ), but
disnecessitates lambdas for slightly more complex reductions. But the
example is out of stock. Do we have one?
More information about the Python-list
mailing list