STINNER Victor added the comment: Yury Selivanov proposed something different in the past: add a "context" (or a context identifier) to tasks to be able to (indirectly) attach local variables to tasks.
"Add notion of context_id to event loop" https://code.google.com/p/tulip/issues/detail?id=165 I don't know if BaseEventLoop._current_handle is too specific or might be implemented with a task context. The task context looks to be specific to tasks, whereas handles are very generic in asyncio: almost all functions in asyncio are called in the context of a handle. Previous discussion related to task context: "local context in event loop" https://groups.google.com/forum/#!topic/python-tulip/zix5HQxtElg "ThreadLocal analogue" https://groups.google.com/forum/#!topic/python-tulip/j0cSjUGx8qk See also the tasklocals project: https://github.com/vkryachko/tasklocals ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue23208> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com