Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What library can I use to implement event driven programming in Python?

Tags:

python

Maybe something like Django signals that doesn't depend on Django.

Django signals can be used to clear cache on saving a model, I'm trying to do the same.

like image 266
satoru Avatar asked Mar 02 '12 00:03

satoru


3 Answers

  • eventlet
  • Twisted
  • Tornado
  • gevent (either forked or based on eventlet's design)

Of the four, eventlet is probably the quickest to pick up and easiest to use - you don't have to modify a lot of your code to make it event-based in the model of eventlet. It basically does some wrapping of the built-in libraries of python, and can do some runtime monkey patching of your code to make it event-based.

like image 110
逆さま Avatar answered Oct 03 '22 22:10

逆さま


It looks like you want a library like PyDispatcher for signal registration and dispatching rather than an event-loop for networking.

like image 30
strcat Avatar answered Oct 03 '22 21:10

strcat


Twisted is for event-driven networking.

like image 31
Matthew Flaschen Avatar answered Oct 03 '22 22:10

Matthew Flaschen