1.1 --- a/README.txt Tue Sep 11 22:49:29 2007 +0000
1.2 +++ b/README.txt Wed Sep 12 00:14:07 2007 +0000
1.3 @@ -70,7 +70,8 @@
1.4 automatically managed by the exchange from which they were acquired.
1.5 * Added MakeParallel: a wrapper instantiated around a normal function which
1.6 sends the result of that function over the supplied channel when invoked.
1.7 - * Added a Map class which attempts to emulate the built-in map function.
1.8 + * Added a Map class which attempts to emulate the built-in map function,
1.9 + along with a pmap function using this class.
1.10 * Extended and updated the examples.
1.11
1.12 New in parallel 0.2.5 (Changes since parallel 0.2.4)
2.1 --- a/pprocess.py Tue Sep 11 22:49:29 2007 +0000
2.2 +++ b/pprocess.py Wed Sep 12 00:14:07 2007 +0000
2.3 @@ -517,7 +517,9 @@
2.4
2.5 def __call__(self, callable, sequence):
2.6
2.7 - "Invoke 'callable' for each element in the 'sequence'."
2.8 + "Wrap and invoke 'callable' for each element in the 'sequence'."
2.9 +
2.10 + wrapped = MakeParallel(callable)
2.11
2.12 # Remember the channel addition order to order output.
2.13
2.14 @@ -525,7 +527,7 @@
2.15 self.results = {}
2.16
2.17 for i in sequence:
2.18 - self.start(callable, *i)
2.19 + self.start(wrapped, *i)
2.20 self.finish()
2.21
2.22 # NOTE: Could use a generator instead.
2.23 @@ -613,11 +615,14 @@
2.24 except OSError:
2.25 pass
2.26
2.27 -def pmap(callable, sequence):
2.28 +def pmap(callable, sequence, limit=None):
2.29
2.30 - "A parallel version of the built-in map function."
2.31 + """
2.32 + A parallel version of the built-in map function with an optional process
2.33 + 'limit'.
2.34 + """
2.35
2.36 - mymap = Map()
2.37 + mymap = Map(limit=limit)
2.38 return mymap(callable, sequence)
2.39
2.40 # vim: tabstop=4 expandtab shiftwidth=4