File: start_loop.py

package info (click to toggle)
pprocess 0.3.1-1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 404 kB
  • ctags: 440
  • sloc: python: 2,048; makefile: 106; sh: 41
file content (20 lines) | stat: -rw-r--r-- 426 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env python

from pprocess import start

def loop(channel, limit):
    print "loop to", limit
    i = channel.receive()
    while i < limit:
        print i
        i = channel.receive()
    channel.send("Done")

if __name__ == "__main__":
    limit = 100
    channel = start(loop, limit)
    for i in range(0, limit + 1):
        channel.send(i)
    print channel.receive()

# vim: tabstop=4 expandtab shiftwidth=4