[Async-sig] async contextmanager

Vincent Michel vxgmichel at gmail.com
Tue Nov 1 13:35:35 EDT 2016


> Has anyone tried to build an asynchronous version of @contextmanager? Is
> it even possible... given the use of yield?

Thanks to PEP 525 - Asynchronous generators [1], it will be possible in 
python 3.6. Here's a possible implementation [2].

[1] https://www.python.org/dev/peps/pep-0525/
[2] 
https://github.com/vxgmichel/aiostream/blob/master/aiostream/context_utils.py

/Vincent


More information about the Async-sig mailing list