This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

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:54srkunzesetrecipients: + srkunze, gvanrossum, vstinner, yselivanov
2015-07-06 18:01:54srkunzesetmessageid: <1436205714.01.0.481233835807.issue24578@psf.upfronthosting.co.za>
2015-07-06 18:01:53srkunzelinkissue24578 messages
2015-07-06 18:01:53srkunzecreate