changeset 623:86aaaa6b9ece

Added doctest to gather_shares.
author Martin Geisler <mg@daimi.au.dk>
date Sat, 29 Mar 2008 20:54:24 +0100
parents 2b9d4c9e959b
children 0321258dd66e
files viff/runtime.py
diffstat 1 files changed, 18 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/viff/runtime.py	Sat Mar 29 19:40:05 2008 +0100
+++ b/viff/runtime.py	Sat Mar 29 20:54:24 2008 +0100
@@ -214,7 +214,24 @@
 def gather_shares(shares):
     """Gather shares.
 
-    Roughly modelled after the Twisted C{gatherResults} function.
+    Roughly modelled after the Twisted C{gatherResults} function. It
+    takes a list of shares and returns a new L{Share} which will be
+    triggered with a list of values, namely the values from the
+    initial shares:
+
+    >>> from pprint import pprint
+    >>> from viff.field import GF256
+    >>> a = Share(None, GF256)
+    >>> b = Share(None, GF256)
+    >>> shares = gather_shares([a, b])
+    >>> shares.addCallback(pprint)           # doctest: +ELLIPSIS
+    <ShareList at 0x...>
+    >>> a.callback(10)
+    >>> b.callback(20)
+    [10, 20]
+
+    @param shares: the shares.
+    @type shares: C{list} of L{Share} objects
     """
 
     def filter_results(results):