1.1 --- a/pprocess.py Tue Sep 11 22:49:29 2007 +0000
1.2 +++ b/pprocess.py Wed Sep 12 00:14:07 2007 +0000
1.3 @@ -517,7 +517,9 @@
1.4
1.5 def __call__(self, callable, sequence):
1.6
1.7 - "Invoke 'callable' for each element in the 'sequence'."
1.8 + "Wrap and invoke 'callable' for each element in the 'sequence'."
1.9 +
1.10 + wrapped = MakeParallel(callable)
1.11
1.12 # Remember the channel addition order to order output.
1.13
1.14 @@ -525,7 +527,7 @@
1.15 self.results = {}
1.16
1.17 for i in sequence:
1.18 - self.start(callable, *i)
1.19 + self.start(wrapped, *i)
1.20 self.finish()
1.21
1.22 # NOTE: Could use a generator instead.
1.23 @@ -613,11 +615,14 @@
1.24 except OSError:
1.25 pass
1.26
1.27 -def pmap(callable, sequence):
1.28 +def pmap(callable, sequence, limit=None):
1.29
1.30 - "A parallel version of the built-in map function."
1.31 + """
1.32 + A parallel version of the built-in map function with an optional process
1.33 + 'limit'.
1.34 + """
1.35
1.36 - mymap = Map()
1.37 + mymap = Map(limit=limit)
1.38 return mymap(callable, sequence)
1.39
1.40 # vim: tabstop=4 expandtab shiftwidth=4