<div dir="ltr">When you do, watch out for some edge cases that may be different from the way threads work. In particular, I can't remember whether it may be possible that the current task before and after `yield from` differs, in case you have multiple event loops. At least the code that manages the data structure used by current_task() allows this possibility.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Apr 21, 2015 at 5:07 PM, Eric Snow <span dir="ltr"><<a href="mailto:ericsnowcurrently@gmail.com" target="_blank">ericsnowcurrently@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Tue, Apr 21, 2015 at 5:59 PM, Guido van Rossum <<a href="mailto:guido@python.org">guido@python.org</a>> wrote:<br>
> There was some discussion of this in<br>
> <a href="https://github.com/python/asyncio/issues/165" target="_blank">https://github.com/python/asyncio/issues/165</a> back in the days. IIRC the<br>
> conclusion was that you could roll this yourself using the<br>
> Tasks.current_task() class method.<br>
<br>
</span>Perfect. Thanks. I may still look into writing a "context-local"<br>
namespace type based on the one in Lib/_threading_local.py.<br>
<span class="HOEnZb"><font color="#888888"><br>
-eric<br>
</font></span></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature">--Guido van Rossum (<a href="http://python.org/~guido" target="_blank">python.org/~guido</a>)</div>
</div>