[Python-ideas] concurrency-local namespaces

Guido van Rossum guido at python.org
Wed Apr 22 02:37:43 CEST 2015


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.

On Tue, Apr 21, 2015 at 5:07 PM, Eric Snow <ericsnowcurrently at gmail.com>
wrote:

> On Tue, Apr 21, 2015 at 5:59 PM, Guido van Rossum <guido at python.org>
> wrote:
> > There was some discussion of this in
> > https://github.com/python/asyncio/issues/165 back in the days. IIRC the
> > conclusion was that you could roll this yourself using the
> > Tasks.current_task() class method.
>
> Perfect.  Thanks.  I may still look into writing a "context-local"
> namespace type based on the one in Lib/_threading_local.py.
>
> -eric
>



-- 
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150421/65b1e912/attachment.html>


More information about the Python-ideas mailing list