[Python-ideas] Async API: some code to review

Yury Selivanov yselivanov.ml at gmail.com
Wed Oct 31 22:31:02 CET 2012


On 2012-10-31, at 5:18 PM, Guido van Rossum <guido at python.org> wrote:

> @async
> def trivial(x):
>    return x
>    yield  # Unreachable, but makes it a generator

FWIW, just a crazy comment: if we make @async decorator to clone
the code object of a passed function and set its (co_flags | 0x0020),
then any passed function becomes a generator, even if it doesn't
have yields/yield-froms ;)

-
Yury



More information about the Python-ideas mailing list