"urikaluzhny" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
On May 15, 10:06 am, "Terry Reedy" <[EMAIL PROTECTED]> wrote:
> "urikaluzhny" <[EMAIL PROTECTED]> wrote in message
>
> news:[EMAIL PROTECTED]
> | 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.

def gen(a):
    for x in a:
        if B: break
        yield x

a_gen = gen(A)

# now iterate over a_gen

-- 
Geoff 


--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to