How to implement an async message bus

Nagy László Zsolt gandalf at shopzeus.com
Fri Oct 16 04:10:33 EDT 2015


>
> It is very annoying that async, await, yield, Future, Condition, Lock
> and almost all other async constructs work with any event loop; but
> simple things like "sleep for 10 seconds" are totally incompatible.
> But I guess I'll have to live with that for now.
>
Some more incompatibilty:

  * ioloop.add_timeout accepts a datetime.timedelta for the timeout
  * asyncio.call_later accepts the number of seconds
  * handler = asyncio.call_later() stands in pair with handler.cancel()
  * Tornado's handler = ioloop.add_timeout() stands in pair with
    ioloop.remove_timeout(handler). Even the syntax is different. 

It looks like I must write a wrapper or subclasses for different event
loop implementations.  I strongly feel that because we have a standard
abstract base class asyncio.BaseEventLoop for event loops,
tornado.IOLoop should be a descendant of it.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20151016/6d8a6b32/attachment.html>


More information about the Python-list mailing list