yield_all needed in Python

Isaac To iketo2 at netscape.net
Thu Mar 3 19:55:04 EST 2005


>>>>> "Paul" == Paul Moore <pf_moore at yahoo.co.uk> writes:

    Paul> You can work around the need for something like yield_all,
    Paul> or explicit loops, by defining an "iflatten" generator,
    Paul> which yields every element of its (iterable) argument,
    Paul> unless the element is a generator, in which case we recurse
    Paul> into it:
    Paul> ...

Only if you'd never want to yield a generator.

Regards,
Isaac.



More information about the Python-list mailing list