Comet Chat with Pylons and cogen
by Dylan SchiemannApril 30th, 2008I ran across an article today demonstrating Comet Chat in Pylons with cogen.
cogen, a project, I was not previous familiar with, is described as:
a crossplatform library for network oriented, coroutine based programming. The interfaces and events/operations aim to mimic thread features. Writing programs using this library is done in a microthread style. Other projects, like Twisted, use continuation style.

If anyone out there is familiar with cogen, I’d love to read a comparison between Twisted and cogen.












May 1st, 2008 at 2:17 am
Roughly there are 3 aspects: library, maturity and style.
Twisted has a rich library of protocols while cogen speaks only wsgi and sockets.
Twisted is more mature and used.
The style in twisted is mostly in 2 layers: you either write your code in callbacks and have full of deferreds all around your code or if some protocol already written in twisted satisfies you, you subclass something and write your code in some methods that will be called.
In cogen you put your code in a generator and your results and requests are passed in and out of the generator. This style relies on the new enhanced generators in python 2.5. You might also want to read PEP342: http://www.python.org/dev/peps/pep-0342/