Yury, you are really the crazy hacker. Not sure tricks with patching bytecode etc are good for standard library.

On Wed, Oct 31, 2012 at 11:31 PM, Yury Selivanov <yselivanov.ml@gmail.com> wrote:
On 2012-10-31, at 5:18 PM, Guido van Rossum <guido@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 ;)

Python-ideas mailing list

Andrew Svetlov