Question

Does anyone know of an event loop library (or bindings) available for Python 3? It's okay if it only does UNIX systems, though I would prefer something that does Windows as well.

ETA: I realize that it is not terribly difficult to write an event loop system. However, I don't want to reinvent the wheel (we are still encouraging not doing so these days, right? ;-))

This is planned for a server application, so obviously I'd want something that isn't tied to a GUI widget toolkit or something.

If the answer is "Nope, there isn't one" (probably; I sure as heck can't find one) then I will most likely create a binding for Python 3 for libev.

Was it helpful?

Solution

I suggest something like:

while True:
    while queue:
        queue.pop()()

For that to work, however, you need to have the event system put callable events onto the queue.

(If you are more interested in a specific binding to a specific framework, such as GTK, Qt, WxWidgets, NCurses, Cocoa, Winforms, whatever, then say that!).

OTHER TIPS

libev is available for python as pyev module: http://code.google.com/p/pyev/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top