Victor Stinner wrote: > I'm still trying to understand how the PEP 3152 would impact asyncio. > Guido suggests to replace "yield from fut" with "cocall fut()" (add > parenthesis) and so add a __cocall__() method to asyncio.Future. > Problem: PEP 3152 says "A cofunction (...) does not contain any yield > or yield from expressions". A __cocall__ method doesn't have to be implemented with a cofunction. Any method that returns an iterator will do, including a generator. So a Future.__cocall__ that just invokes Future.__iter__ should work fine. > How is it possible to suspend a cofunction if it's not possible to use yield? The currently published version of PEP 3152 is not really complete. A few things would need to be added to it, one of them being a suspend() builtin that has the same effect as yield in a generator-based coroutine. -- Greg
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4