diff --git a/docs/api.rst b/docs/api.rst index 61c45f73..524e6967 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -76,10 +76,9 @@ contexts. total = 0 recvs = [c.call_async(long_running_operation) for c in contexts] - with mitogen.master.Select(recvs) as select: - for recv, (msg, data) in select: - print 'Got %s from %s' % (data, recv) - total += data + for recv, (msg, data) in mitogen.master.Select(recvs): + print 'Got %s from %s' % (data, recv) + total += data # Iteration ends when last Receiver yields a result. print 'Received total %s from %s receivers' % (total, len(recvs)) @@ -108,9 +107,8 @@ contexts. ]) ] - with mitogen.master.Select(selects) as select: - for _, (msg, data) in select: - print data + for recv, (msg, data) in mitogen.master.Select(selects): + print data .. py:method:: get (timeout=None) diff --git a/docs/index.rst b/docs/index.rst index 885a9244..49a56464 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -269,8 +269,7 @@ available. for name in dirnames + filenames), 0) total = 0 - for recv, msg in Select(c.call_async(usage, '/tmp') for c in contexts): - value = result.unpickle() + for recv, (msg, value) in Select(c.call_async(usage, '/tmp') for c in contexts): print 'Context %s /tmp usage: %d' % (recv.context, value) total += value