?

Alexandr N Zamaraev tonal at promsoft.ru
Thu May 15 23:46:33 EDT 2008


urikaluzhny wrote:
>> | It seems that I rather frequently need a list or iterator of the form
>> | [x for x in <> while <>]
>> I can think of two ways to interpret that.
> I mean like [x for x in <A> if <B>], only that it breaks the loop when
> the expression <B> is false.
How do you plan to modify B during iteration?
May be
[x for x in itertools.takewhile(<B>, <A>)]
when <B> function accept element <A> and return True or False





More information about the Python-list mailing list