# HG changeset patch # User paulb # Date 1189805593 0 # Node ID 88f285db505f55461948b4299f7e7a69b79e2509 # Parent dfdd46d6e9a2d305e378acca503d42e82742a586 [project @ 2007-09-14 21:33:13 by paulb] Improved docstrings. diff -r dfdd46d6e9a2 -r 88f285db505f pprocess.py --- a/pprocess.py Thu Sep 13 22:02:15 2007 +0000 +++ b/pprocess.py Fri Sep 14 21:33:13 2007 +0000 @@ -492,7 +492,9 @@ """ Wrap the given 'callable', using the given 'exchange' to monitor the channels created for communications between this and the created - processes. + processes. Note that the 'callable' must be parallel-aware (that is, + have a 'channel' parameter). Use the MakeParallel class to wrap other + kinds of callable objects. """ self.callable = callable @@ -557,7 +559,12 @@ def __init__(self, callable): - "Initialise the wrapper with the given 'callable'." + """ + Initialise the wrapper with the given 'callable'. This object will then + be able to accept a 'channel' parameter when invoked, and to forward the + result of the given 'callable' via the channel provided back to the + invoking process. + """ self.callable = callable @@ -592,10 +599,12 @@ """ Create a new process which shall start running in the given 'callable'. - Return a communications channel to the creating process, and supply such a - channel to the created process as the 'channel' parameter in the given - 'callable'. Additional arguments to the 'callable' can be given as - additional arguments to this function. + Additional arguments to the 'callable' can be given as additional arguments + to this function. + + Return a communications channel to the creating process. For the created + process, supply a channel as the 'channel' parameter in the given 'callable' + so that it may send data back to the creating process. """ channel = create() @@ -626,8 +635,12 @@ """ A parallel version of the built-in map function with an optional process - 'limit'. The given 'callable' need not be parallel-aware since it will be - wrapped for parallel communications before invocation. + 'limit'. The given 'callable' should not be parallel-aware (that is, have a + 'channel' parameter) since it will be wrapped for parallel communications + before being invoked. + + Return the processed 'sequence' where each element in the sequence is + processed by a different process. """ mymap = Map(limit=limit)