[Python-checkins] peps: Minor clarifications.

guido.van.rossum python-checkins at python.org
Thu May 30 00:33:57 CEST 2013


http://hg.python.org/peps/rev/a33c5941269a
changeset:   4918:a33c5941269a
user:        Guido van Rossum <guido at python.org>
date:        Wed May 29 15:33:55 2013 -0700
summary:
  Minor clarifications.

files:
  pep-3156.txt |  30 ++++++++++++++++++------------
  1 files changed, 18 insertions(+), 12 deletions(-)


diff --git a/pep-3156.txt b/pep-3156.txt
--- a/pep-3156.txt
+++ b/pep-3156.txt
@@ -846,6 +846,12 @@
   convention from the section "Callback Style" below) is always called
   with a single argument, the Future object.
 
+- ``remove_done_callback(fn)``.  Remove the argument from the list of
+  callbacks.  This method is not defined by PEP 3148.  The argument
+  must be equal (using ``==``) to the argument passed to
+  ``add_done_callback()``.  Returns the number of times the callback
+  was removed.
+
 - ``set_result(result)``.  The Future must not be done (nor cancelled)
   already.  This makes the Future done and schedules the callbacks.
   Difference with PEP 3148: This is a public API.
@@ -1302,25 +1308,25 @@
 
   - ``FIRST_EXCEPTION``: Wait until at least one Future is done (not
     cancelled) with an exception set.  (The exclusion of cancelled
-    Futures from the filter is surprising, but PEP 3148 does it this
-    way.)
+    Futures from the condition is surprising, but PEP 3148 does it
+    this way.)
 
 - ``tulip.as_completed(fs, timeout=None)``.  Returns an iterator whose
-  values are Futures; waiting for successive values waits until the
-  next Future or coroutine from the set ``fs`` completes, and returns
-  its result (or raises its exception).  The optional argument
-  ``timeout`` has the same meaning and default as it does for
-  ``concurrent.futures.wait()``: when the timeout occurs, the next
-  Future returned by the iterator will raise ``TimeoutError`` when
-  waited for.  Example of use::
+  values are Futures or coroutines; waiting for successive values
+  waits until the next Future or coroutine from the set ``fs``
+  completes, and returns its result (or raises its exception).  The
+  optional argument ``timeout`` has the same meaning and default as it
+  does for ``concurrent.futures.wait()``: when the timeout occurs, the
+  next Future returned by the iterator will raise ``TimeoutError``
+  when waited for.  Example of use::
 
     for f in as_completed(fs):
         result = yield from f  # May raise an exception.
         # Use result.
 
-  Note: if you do not wait for the futures as they are produced by the
-  iterator, your ``for`` loop may not make progress (since you are not
-  allowing other tasks to run).
+  Note: if you do not wait for the values produced by the iterator,
+  your ``for`` loop may not make progress (since you are not allowing
+  other tasks to run).
 
 Sleeping
 --------

-- 
Repository URL: http://hg.python.org/peps


More information about the Python-checkins mailing list