[Python-ideas] concurrency-local namespaces
Guido van Rossum
guido at python.org
Wed Apr 22 01:59:32 CEST 2015
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.
On Tue, Apr 21, 2015 at 4:48 PM, Eric Snow <ericsnowcurrently at gmail.com>
> threading.local provides thread-local namespaces. As far as I can
> tell, there isn't an equivalent for coroutines (asyncio), even though
> I would expect they would provide the same benefits. I'd like to see
> coroutine-local namespaces added and would be happy to work on the
> problem. I plan on working on a feature that will rely on applying a
> thread-local context and realized that coroutines would need a similar
> treatment. Also, there are probably a few spots in the stdlib that
> would benefit (e.g. decimal contexts).
> Perhaps I'm missing something. Is the concurrency story with
> coroutines different enough that coroutine-local namespaces do not
> make sense?
> If they still make sense, is there a mechanism to uniquely identify
> the "currently running" coroutine like you can with threads? That
> would be necessary to do a naive port of thread-local namespaces.
> Python-ideas mailing list
> Python-ideas at python.org
> Code of Conduct: http://python.org/psf/codeofconduct/
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas