[BangPypers] Co-operating threads

Anomit Ghosh anomit.ghosh at gmail.com
Wed Oct 20 16:06:02 CEST 2010

Talking of co-operating "threads", I like the idea of greenthreads
implemented with the help of greenlets[1] in eventlet [2]. Another
similar library is gevent[3] that uses a "hub" like eventlet but that
purely uses libevent. You can leave the scheduling upto the hubs in
both these libraries which results in lot less boilerplate with the
added advantage of writing asynchronous code in the synchronous style
that we are generally used to. The hub will take care of switching
between the greenlets when they perform a "blocking" operation. It's
difficult for me to explain all of these in one single reply. I'd
suggest going through some of the examples in their docs for a better
understanding of this unusual pattern of writing programs. No
callbacks, no reactors, no deferreds ;-)

[1] http://pypi.python.org/pypi/greenlet
[2] http://eventlet.net
[3] http://gevent.org
Anomit Ghosh

More information about the BangPypers mailing list