[Python-checkins] peps: Change the definition of wait_for() to a more useful one.
guido.van.rossum
python-checkins at python.org
Wed Jan 22 23:48:46 CET 2014
http://hg.python.org/peps/rev/bcd20b88eada
changeset: 5355:bcd20b88eada
user: Guido van Rossum <guido at dropbox.com>
date: Wed Jan 22 14:48:12 2014 -0800
summary:
Change the definition of wait_for() to a more useful one.
(This is a change in the spec. But I don't recall we ever seriously
discussed this part of the spec, and the new behavior is more useful
and more intuitive. See discussion started by Gustavo Carneiro in
http://code.google.com/p/tulip/issues/detail?id=107 .)
files:
pep-3156.txt | 9 ++++-----
1 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/pep-3156.txt b/pep-3156.txt
--- a/pep-3156.txt
+++ b/pep-3156.txt
@@ -1582,11 +1582,10 @@
your ``for`` loop may not make progress (since you are not allowing
other tasks to run).
-- ``asyncio.wait_for(f, timeout)``. This is a convenience to wait for a
- single coroutine or Future with a timeout. It is a simple wrapper
- around ``asyncio.wait()`` with a single item in the first argument,
- returning the result or raising the exception if it is completed
- within the timeout, raising ``TimeoutError`` otherwise.
+- ``asyncio.wait_for(f, timeout)``. This is a convenience to wait for
+ a single coroutine or Future with a timeout. When a timeout occurs,
+ it cancels the task and raises TimeoutError. To avoid the task
+ cancellation, wrap it in shield().
- ``asyncio.gather(f1, f2, ...)``. Returns a Future which waits until
all arguments (Futures or coroutines) are done and return a list of
--
Repository URL: http://hg.python.org/peps
More information about the Python-checkins
mailing list