"Peter Otten" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I'd rather have a second look whether the test is really needed.

That's too obscure of a hint.
Can you be a bit more explicit?
Here's an example (below).
You're saying I think that most of it is unnecessary.
Thanks,
Alan

def ireduce(func, iterable, init=None):
    iterable = iter(iterable)
    if init is None:
        init = iterable.next()
        yield init
    else:
        try:
            first = iterable.next()
            init = func(init, first)
            yield init
        except StopIteration:
            yield init
    for item in iterable:
        init = func(init, item)
        yield init


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

Reply via email to