[Python-Dev] PEP 492: async/await in Python; version 5

Yury Selivanov yselivanov.ml at gmail.com
Tue May 5 23:38:09 CEST 2015

On 2015-05-05 5:01 PM, Paul Moore wrote:
> On 5 May 2015 at 21:00, Yury Selivanov <yselivanov.ml at gmail.com> wrote:
>> On 2015-05-05 3:40 PM, Jim J. Jewett wrote:
>>> On Tue May 5 18:29:44 CEST 2015, Yury Selivanov posted an updated PEP492.
>>> Where are the following over-simplifications wrong?
>>> (1)  The PEP is intended for use (almost exclusively) with
>>> asychronous IO and a scheduler such as the asynchio event loop.
>> Yes. You can also use it for UI loops.  Basically, anything
>> that can call your code asynchronously.
> Given that the stdlib doesn't provide an example of such a UI loop,
> what would a 3rd party module need to implement to provide such a
> thing? Can any of the non-IO related parts of asyncio be reused for
> the purpose, or must the 3rd party module implement everything from
> scratch?

The idea is that you integrate processing of UI events to
your event loop of choice.  For instance, Twisted has
integration for QT and other libraries [1].  This way you
can easily combine async network (or OS) calls with your
UI logic to avoid "callback hell".

Quick search for something like that for asyncio revealed
this library: [2].  This small library actually re-implements
relevant low-level parts of the asyncio event loop on top of
QT primitives (another approach).


[1] http://twistedmatrix.com/trac/wiki/QTReactor
[2] https://github.com/harvimt/quamash#usage -- see first_50

More information about the Python-Dev mailing list