[ x for x in xrange(10) when p(x) ]
bonono at gmail.com
bonono at gmail.com
Fri Nov 11 01:47:29 EST 2005
oops, stand corrected. I was under the impression that an exception
would break out of the current expression and forgot that the "for"
would contain it(that StopIteration is a condition to it expects to
stop it).
thanks, this is the functionality I am looking for.
Alex Martelli wrote:
> Can you give one example where this stop() function wouldn't work and
> your hypothetical ``when'' would? I don't see how "it breaks out of the
> whole thing expression" -- it terminates ONE for-clause (and what else
> would your cherished ``when'' do?).
>
>
> Alex
More information about the Python-list
mailing list