> One of my only peeves with LCs is that they always iterate to the end,
> I'd like an optional extra 'until' clause, like:
>
> lst = [n for n in veryBigSequence if someTest(n) until anotherTest(n)]
>
> This would act as usual until the final expression was true at which
> point it would stop iterating.
>
> If I could find the time/inclination I might even try throwing it in
> as
> a PEP sometime...


i think that's a great idea.  my head's telling me "break" but "until"
sounds more appropriate.  you should file both a regular and a
3000-PEP... at least the latter since it's the future.  :-)

-wesley
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to