[Python-ideas] PEP 380 alternative: A yielding function

Anders J. Munch 2010 at jmunch.dk
Wed Jul 28 19:58:53 CEST 2010


Scott Dial wrote:
 > Except now yield_if_true() is not a generator. So, you have two classes
 > of "generators" now (top-level/delegated), which breaks all sorts of
 > things.

Right, yield_if_true is a regular function, that's the whole point.

There'd still only be one kind of generator, defined by the presence
of the yield keyword. Nothing would break.

The function that calls yield_if_true (or some other function up the
call chain) would need to be a generator, if necessary made such using
the traditional workaround
    if 0: yield

regards, Anders




More information about the Python-ideas mailing list