[Stackless] tasklet vs. taskoutlet function
tismer at tismer.com
Tue Sep 17 12:12:13 CEST 2002
Håvard Engum wrote:
> I am quite new to Stackless Python, and I am having some problems using
> the newest version of it.
> Earlier, you could make new tasklets from the taskoutlet function like
> this(simpleAgent is here a plain function):
>>>>agentFactory = stackless.taskoutlet(simpleAgent)
>>>>agents = [agentFactory(i) for i in range(numAgents)]
> And then you would have a list of references to tasklets in the
> list agents. You could then insert the tasklets into the scheduler and
> then switch between them.
> I grabbed the newest version of Stackless from the CVS-repository. There I
> didn't find any taskoutlet function, but just a tasklet-function that
> doesn't behave the way the old taskoutlet function did.
Yes, the taskoutlet was overkill. I dropped it.
You are right: Tasklets don't produce series of
bound tasklets at the moment, they are bound once.
I'm going to add a spawn() method to them which
will produce a new tasklet, whether the old one
is bound or not.
For the moment, you just rewrite it as:
def factory: return stackless.tasklet(simpleAgent)
agents = [factory(i) for i in range(numAgents)]
> My question is how to make a queue of tasklets with the new version of
> Stackless Python, and then switch between these.
> Do there exist any quite updated documentation on Stackless Python? I have
> searched the net, but I haven't found much.
Absolutely nothing but the __doc__ strings yet ;)
this-is-bloody-alpha-code - ciao - chris
Christian Tismer :^) <mailto:tismer at tismer.com>
Mission Impossible 5oftware : Have a break! Take a ride on Python's
Johannes-Niemeyer-Weg 9a : *Starship* http://starship.python.net/
14109 Berlin : PGP key -> http://wwwkeys.pgp.net/
work +49 30 89 09 53 34 home +49 30 802 86 56 pager +49 173 24 18 776
PGP 0x57F3BF04 9064 F4E1 D754 C2FF 1619 305B C09C 5A3B 57F3 BF04
whom do you want to sponsor today? http://www.stackless.com/
Stackless mailing list
Stackless at www.tismer.com
More information about the Stackless