From cdc8dab2cec8ac6f84ff678984fac8c0f26741c7 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Wed, 29 May 2013 15:33:55 -0700 Subject: [PATCH] Minor clarifications. --- pep-3156.txt | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/pep-3156.txt b/pep-3156.txt index 091f7ffb3..1c79d6bb0 100644 --- a/pep-3156.txt +++ b/pep-3156.txt @@ -846,6 +846,12 @@ public API is as follows, indicating the differences with PEP 3148: 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 @@ package are provided: - ``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 --------