On Oct 31, 2009, at 4:27 AM, Andrew Francis wrote:
I would appreciate comments before putting it in the Stackless repository (however I do that).

As style comment only, the ()s are not usually written in 'while' and 'if' terms. That is, lines like

   while(True):
      if (flag):

are typically written

    while True:
        if flag:


I believe you need to make
         fd = open('sieve.dat','w')
be "wb" so that it can work on Windows. I have not tested this.


I don't know if you have pedagogical reasons, but I prefer to write

def filter(prime, listen, send):
    while (True):
       i = listen.receive()
       if (i % prime):
          send.send(i)

as

def filter(prime, listen, send):
    for i in listen:
       if i % prime:
          send.send(i)



and

def counter(c):
    i = 2
    while (True):
        c.send(i)
        i += 1

as

import itertools
def counter(c):
    for i in itertools.count(2):
        c.send(i)

or even

import itertools
def counter(c):
    c.send_sequence(itertools.count(2))



I am having trouble making your demo work (after loading the image it still starts from the beginning), but I suspect that might be to my now years out of date Stackless.

Cheers,
                                Andrew
                                [email protected]



_______________________________________________
Stackless mailing list
[email protected]
http://www.stackless.com/mailman/listinfo/stackless

Reply via email to