[Stackless] Stackless support generator functions?

Aaron Watters aaron at reportlab.com
Thu Sep 26 16:14:10 CEST 2002


I don't know the answer (I assume so), but I do know that channels provide
far more general functionality.  The yeild thing only goes one level deep
into a function call, whereas a channel can pass values from anywhere inside
a computation.

For example you could "linearize" a tree something like this

def preorderToChannel(tree, channel):
      (node, children) = tree
      channel.send(node)
      for child in children:
             preorderToChannel(child, channel)

...then launch preorderToChannel(tree, channel) in its own tasklet.

As I understand it implementing a "preorder generator" using
the "yeild" construct would be much more complicated, unless
you cheated and stashed the result in a list or something first.

Please correct me if I'm wrong...

   -- Aaron Watters

Robert Oschler wrote:

> Does Stackless support Python 2.2 generator functions?
>
>  
>
> thx
>
>  
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.stackless.com/pipermail/stackless/attachments/20020926/2a17be18/attachment.htm>


More information about the Stackless mailing list