Message246373
| Author |
srkunze |
| Recipients |
gvanrossum, srkunze, vstinner, yselivanov |
| Date |
2015年07月06日.18:01:53 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1436205714.01.0.481233835807.issue24578@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
In order to complement http://bugs.python.org/issue24571, this is another high-level convenience API for asyncio to treat an awaitable like a usual subroutine (credits go to Nick Coghlan):
# Call awaitable from synchronous code
def wait_for_result(awaitable):
"""Usage: result = asyncio.wait_for_result(awaitable)"""
return asyncio.get_event_loop().run_until_complete(awaitable.__await__())
It may not be that conceptually dense, however, I feel for projects transitioning from the classical subroutine world to the asyncio world, this functionality might prove useful to bridge both worlds seamlessly when necessary. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2015年07月06日 18:01:54 | srkunze | set | recipients:
+ srkunze, gvanrossum, vstinner, yselivanov |
| 2015年07月06日 18:01:54 | srkunze | set | messageid: <1436205714.01.0.481233835807.issue24578@psf.upfronthosting.co.za> |
| 2015年07月06日 18:01:53 | srkunze | link | issue24578 messages |
| 2015年07月06日 18:01:53 | srkunze | create |
|