why greenlet, gevent or the stackless are needed?

Damjan gdamjan at gmail.com
Sat Jul 7 11:38:53 EDT 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

http://greenlet.readthedocs.org/en/latest/index.html


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.




-- 
damjan




More information about the Python-list mailing list