[Tutor] How to determine if every character in one string isinanother string?

wesley chun wescpy at gmail.com
Tue Jul 24 00:32:50 CEST 2007


> 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


More information about the Tutor mailing list