why greenlet, gevent or the stackless are needed?
gdamjan at gmail.com
Sat Jul 7 17:38:53 CEST 2012
On 07.07.2012 09:09, self.python wrote:
> (I'm very new to this coroutine part
> so It's not supposed to attack these modules,
> just I don't know the differences)
> atfer version 2.5, python officially support coroutine with yield.
> and then, why greenlet, gevent, Stackless python are still useful?
> it there somthing that "yield" can't do
> or just it is easier or powerful?
The greenlet site has some very simple examples what it can provide.
For example jumping from one function in another, and back
Gevent then uses greenlet to do lightweight "processes" (greenlets) that
are I/O scheduled. This allows for a simple model of programming that
scales to a large number of concurrent connections. You could do that
with threads but you can't start as many threads as greenlets, since
they have a much larger memory address space footprint.
There's one function, called the gevent hub, that waits for any I/O
event and then switches to the function that "blocked" on that I/O.
More information about the Python-list