Yury, you are really the crazy hacker. Not sure tricks with patching bytecode etc are good for standard library.<div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Oct 31, 2012 at 11:31 PM, Yury Selivanov <span dir="ltr"><<a href="mailto:yselivanov.ml@gmail.com" target="_blank">yselivanov.ml@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On 2012-10-31, at 5:18 PM, Guido van Rossum <<a href="mailto:guido@python.org">guido@python.org</a>> wrote:<br>
<br>
> @async<br>
> def trivial(x):<br>
> return x<br>
> yield # Unreachable, but makes it a generator<br>
<br>
</div>FWIW, just a crazy comment: if we make @async decorator to clone<br>
the code object of a passed function and set its (co_flags | 0x0020),<br>
then any passed function becomes a generator, even if it doesn't<br>
have yields/yield-froms ;)<br>
<br>
-<br>
Yury<br>
<div class="HOEnZb"><div class="h5">_______________________________________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org">Python-ideas@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/python-ideas" target="_blank">http://mail.python.org/mailman/listinfo/python-ideas</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Thanks,<br>Andrew Svetlov<br>
</div>