[x for x in <> while <>]?

Paul Rubin http
Thu May 15 04:15:09 EDT 2008


urikaluzhny <ukaluzhny at nds.com> writes:
> It seems that I rather frequently need a list or iterator of the form
> [x for x in <> while <>]
> And there is no one like this.
> May be there is another short way to write it (not as a loop). Is there?

itertools.takewhile(condition, seq)



More information about the Python-list mailing list