On Wed, Nov 2, 2011 at 10:05 AM, Terry Reedy email@example.com wrote:
There will be a special form of Python function called a "cofunction", defined using the new keyword ``codef`` in place of ``def``.
Is this really needed? The presence of 'coyield' signals 'cofunction', just as 'yield' signals 'generator'. Does a cofunction without a suspend point make sense? (And if it did, 'if False: coyield' or 'coyield' after 'return' could serve as a signal.)
Something is needed, since there probably won't *be* an explicit coyield in the top level function (instead, it would call async I/O operations that used coyield internally).
However, as per the previous thread, I don't believe this needs to be embedded in the bytecode by the compiler - it could instead be a runtime switch in the eval loop, changing the way function calls and iteration are handled.