Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Most "active" coroutine library project?

Reply
Thread Tools

Most "active" coroutine library project?

 
 
Phillip B Oldham
Guest
Posts: n/a
 
      08-23-2009
I've been taking a look at the multitude of coroutine libraries
available for Python, but from the looks of the projects they all seem
to be rather "quiet". I'd like to pick one up to use on a current
project but can't deduce which is the most popular/has the largest
community.

Libraries I looked at include: cogen, weightless, eventlet and
circuits (which isn't exactly coroutine-based but it's event-driven
model was intriguing).

Firstly, are there any others I've missed? And what would the
consensus be on the which has the most active community behind it?
 
Reply With Quote
 
 
 
 
Matthew Woodcraft
Guest
Posts: n/a
 
      08-23-2009
Phillip B Oldham <(E-Mail Removed)> writes:

> I've been taking a look at the multitude of coroutine libraries
> available for Python, but from the looks of the projects they all seem
> to be rather "quiet". I'd like to pick one up to use on a current
> project but can't deduce which is the most popular/has the largest
> community.
>
> Libraries I looked at include: cogen, weightless, eventlet and
> circuits (which isn't exactly coroutine-based but it's event-driven
> model was intriguing).
>
> Firstly, are there any others I've missed?


There's greenlets

http://pypi.python.org/pypi/greenlet

which I think is also fairly described as "quiet".

-M-
 
Reply With Quote
 
 
 
 
Denis
Guest
Posts: n/a
 
      08-25-2009
You can also at gevent

http://pypi.python.org/pypi/gevent


On Aug 23, 10:02*pm, Phillip B Oldham <(E-Mail Removed)>
wrote:
> I've been taking a look at the multitude of coroutine libraries
> available for Python, but from the looks of the projects they all seem
> to be rather "quiet". I'd like to pick one up to use on a current
> project but can't deduce which is the most popular/has the largest
> community.
>
> Libraries I looked at include: cogen, weightless, eventlet and
> circuits (which isn't exactly coroutine-based but it's event-driven
> model was intriguing).
>
> Firstly, are there any others I've missed? And what would the
> consensus be on the which has the most active community behind it?


 
Reply With Quote
 
Brian Hammond
Guest
Posts: n/a
 
      09-23-2009
On Aug 25, 12:51*am, Denis <(E-Mail Removed)> wrote:
> You can also at gevent
>
> http://pypi.python.org/pypi/gevent


Please, please document this! There are a lot of people who would
love to use this but give up when they don't find a guide or something
similar.
 
Reply With Quote
 
Simon Forman
Guest
Posts: n/a
 
      09-23-2009
On Sun, Aug 23, 2009 at 11:02 AM, Phillip B Oldham
<(E-Mail Removed)> wrote:
> I've been taking a look at the multitude of coroutine libraries
> available for Python, but from the looks of the projects they all seem
> to be rather "quiet". I'd like to pick one up to use on a current
> project but can't deduce which is the most popular/has the largest
> community.
>
> Libraries I looked at include: cogen, weightless, eventlet and
> circuits (which isn't exactly coroutine-based but it's event-driven
> model was intriguing).
>
> Firstly, are there any others I've missed? And what would the
> consensus be on the which has the most active community behind it?
> --
> http://mail.python.org/mailman/listinfo/python-list
>


Coroutines are built into the language. There's a good talk about
them here: http://www.dabeaz.com/coroutines/

HTH,
~Simon
 
Reply With Quote
 
exarkun@twistedmatrix.com
Guest
Posts: n/a
 
      09-23-2009
On 05:00 pm, http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
>On Sun, Aug 23, 2009 at 11:02 AM, Phillip B Oldham
><(E-Mail Removed)> wrote:
>>I've been taking a look at the multitude of coroutine libraries
>>available for Python, but from the looks of the projects they all seem
>>to be rather "quiet". I'd like to pick one up to use on a current
>>project but can't deduce which is the most popular/has the largest
>>community.
>>
>>Libraries I looked at include: cogen, weightless, eventlet and
>>circuits (which isn't exactly coroutine-based but it's event-driven
>>model was intriguing).
>>
>>Firstly, are there any others I've missed? And what would the
>>consensus be on the which has the most active community behind it?
>>--
>>http://mail.python.org/mailman/listinfo/python-list

>
>Coroutines are built into the language. There's a good talk about
>them here: http://www.dabeaz.com/coroutines/


But what some Python programmers call coroutines aren't really the same
as what the programming community at large would call a coroutine.

Jean-Paul
 
Reply With Quote
 
Simon Forman
Guest
Posts: n/a
 
      09-23-2009
On Wed, Sep 23, 2009 at 2:05 PM, <(E-Mail Removed)> wrote:
> On 05:00 pm, (E-Mail Removed) wrote:
>>
>> On Sun, Aug 23, 2009 at 11:02 AM, Phillip B Oldham
>> <(E-Mail Removed)> wrote:
>>>
>>> I've been taking a look at the multitude of coroutine libraries
>>> available for Python, but from the looks of the projects they all seem
>>> to be rather "quiet". I'd like to pick one up to use on a current
>>> project but can't deduce which is the most popular/has the largest
>>> community.
>>>
>>> Libraries I looked at include: cogen, weightless, eventlet and
>>> circuits (which isn't exactly coroutine-based but it's event-driven
>>> model was intriguing).
>>>
>>> Firstly, are there any others I've missed? And what would the
>>> consensus be on the which has the most active community behind it?
>>> --
>>> http://mail.python.org/mailman/listinfo/python-list

>>
>> Coroutines are built into the language. *There's a good talk about
>> them here: http://www.dabeaz.com/coroutines/

>
> But what some Python programmers call coroutines aren't really the same as
> what the programming community at large would call a coroutine.
>
> Jean-Paul


Really? I'm curious as to the differences. (I just skimmed the entry
for coroutines in Wikipedia and PEP 342, but I'm not fully
enlightened.)

Warm regards,
~Simon
 
Reply With Quote
 
Grant Edwards
Guest
Posts: n/a
 
      09-23-2009
On 2009-09-23, Simon Forman <(E-Mail Removed)> wrote:

>>> Coroutines are built into the language. ?There's a good talk
>>> about them here: http://www.dabeaz.com/coroutines/

>>
>> But what some Python programmers call coroutines aren't really
>> the same as what the programming community at large would call
>> a coroutine.

>
> Really? I'm curious as to the differences.


Me too. I read through the presentation above, it it seems to
describe pretty much exactly what we called co-routines both in
school and in the workplace.

Back when I worked on one of the first hand-held cellular
mobile phones, it used co-routines where the number of
coroutines was fixed at 2 (one for each register set in a Z80
CPU). The semantics seem to be identical to the coroutines
described in the presentation.

> (I just skimmed the entry for coroutines in Wikipedia and PEP
> 342, but I'm not fully enlightened.)


--
Grant Edwards grante Yow! I was born in a
at Hostess Cupcake factory
visi.com before the sexual
revolution!
 
Reply With Quote
 
exarkun@twistedmatrix.com
Guest
Posts: n/a
 
      09-23-2009
On 08:16 pm, (E-Mail Removed) wrote:
>On Wed, Sep 23, 2009 at 2:05 PM, <(E-Mail Removed)> wrote:
>[snip]
>>
>>But what some Python programmers call coroutines aren't really the
>>same as
>>what the programming community at large would call a coroutine.
>>
>>Jean-Paul

>
>Really? I'm curious as to the differences. (I just skimmed the entry
>for coroutines in Wikipedia and PEP 342, but I'm not fully
>enlightened.)


The important difference is that coroutines can switch across multiple
stack frames. Python's "enhanced generators" can still only switch
across one stack frame - ie, from inside the generator to the frame
immediately outside the generator. This means that you cannot use
"enhanced generators" to implement an API like this one:

def doSomeNetworkStuff():
s = corolib.socket()
s.connect(('google.com', 80))
s.sendall('GET / HTTP/1.1\r\nHost: www.google.com\r\n\r\n')
response = s.recv(8192)

where connect, sendall, and recv don't actually block the entire calling
thread, they only switch away to another coroutine until the underlying
operation completes. With "real" coroutines, you can do this.

Jean-Paul
 
Reply With Quote
 
Grant Edwards
Guest
Posts: n/a
 
      09-23-2009
On 2009-09-23, (E-Mail Removed) <(E-Mail Removed)> wrote:
> On 08:16 pm, (E-Mail Removed) wrote:
>>On Wed, Sep 23, 2009 at 2:05 PM, <(E-Mail Removed)> wrote:
>>[snip]
>>>
>>>But what some Python programmers call coroutines aren't really the
>>>same as
>>>what the programming community at large would call a coroutine.
>>>
>>>Jean-Paul

>>
>>Really? I'm curious as to the differences. (I just skimmed
>>the entry for coroutines in Wikipedia and PEP 342, but I'm not
>>fully enlightened.)

>
> The important difference is that coroutines can switch across
> multiple stack frames. Python's "enhanced generators" can
> still only switch across one stack frame - ie, from inside the
> generator to the frame immediately outside the generator.


Good point. Being unable to "yeild" from inside a function
called by the "main" coroutine can be limiting once you try to
do something non-trivial. I had read about that limitation,
but had forgotten it.

Some "stackless" threading schemes for C (e.g. Protothreads
http://www.sics.se/~adam/pt/) have the same issue, and it does
require some extra effort to work around that limitation.

--
Grant Edwards grante Yow! I have accepted
at Provolone into my life!
visi.com
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help writing coroutine Matthew Wilson Python 1 11-07-2007 05:38 PM
Flickr: difference between "most relevant" and "most interesting" Max Digital Photography 7 09-26-2007 10:38 PM
Question: How efficient is using generators for coroutine-likeproblems? Carlos Ribeiro Python 3 09-26-2004 05:50 PM
Invoking the Constructor of the Top Most Class in the Hierarchy from the Bottom most class H.MuthuKumaraRajan Java 3 02-04-2004 01:33 PM



Advertisments