1. i think that yield statements in python only work in one level of
loop. since cogen uses yield statements, does that mean it won't work
in nested loops?
2. can i use continuations in cogen, for example by pickling tasks?
3. why does the page say that twisted uses continuations? i thought
it uses deferreds, i.e. callbacks.
4. is there a way i could use the iocp support with something outside
of cogen, for example Stackless (in case I need to use Stackless
instead)?
thx..
HeyOn Tue, May 20, 2008 at 8:52 AM, inhahe <inh...@gmail.com> wrote:
1. i think that yield statements in python only work in one level of
loop. since cogen uses yield statements, does that mean it won't work
in nested loops?
Well, this is a know limitation of python's generators.
However, there is a wrapper that can help you out (cogen.core.events.Call)
http://cogen.googlecode.com/svn/trunk/docs/cogen.core.events.Call.html
2. can i use continuations in cogen, for example by pickling tasks?
I don't think the concept of continuations is synonymous with execution state serialization.
Also, since my implementation is on top of vanilla python you can't have all the
features that stackless offers.
That is you can't pickle tasks. But I wonder why would you need this.
3. why does the page say that twisted uses continuations? i thought
it uses deferreds, i.e. callbacks.
Twisted uses a form continuation passing style by using deferreds - well, i think i need to edit that page a bit (i forgot to write passing).
http://en.wikipedia.org/wiki/Continuation_passing_style
However, feel free to correct me if i got this wrong.
4. is there a way i could use the iocp support with something outside
of cogen, for example Stackless (in case I need to use Stackless
instead)?
cogen was made for python2.5, but you could interleave cogen's loop in stackless.
I could make you an example if you really need to do this.
Also, cogen doesn't use any stackless features (not even greenlets - wich is
stack hacking spin-off from stackless) so it would be pretty pointless since
you could have a much faster library using those features.
If you really need stackless than you should use stackless.
The are some examples on iocp with stackless here:
http://stacklessexamples.googlecode.com/svn/trunk/
Also, take a look at:
http://code.google.com/p/stacklessexamples/wiki/StacklessNetworking
thx..
What sort of application are you trying to build anyway ?
--
http://ionelmc.wordpress.com