Add async(). See https://codereview.appspot.com/9245047/
This commit is contained in:
parent
023010c742
commit
8acf02f633
11
pep-3156.txt
11
pep-3156.txt
|
@ -260,8 +260,7 @@ methods, and still conform to the other methods.)
|
|||
- Basic callbacks: ``call_soon()``, ``call_later()``, ``call_at()``.
|
||||
|
||||
- Thread interaction: ``call_soon_threadsafe()``,
|
||||
``wrap_future()``, ``run_in_executor()``,
|
||||
``set_default_executor()``.
|
||||
``run_in_executor()``, ``set_default_executor()``.
|
||||
|
||||
- Internet name lookups: ``getaddrinfo()``, ``getnameinfo()``.
|
||||
|
||||
|
@ -903,7 +902,13 @@ However the current PEP strives to have no dependencies beyond Python
|
|||
3.3, so changes to ``concurrent.futures.Future`` are off the table for
|
||||
now.
|
||||
|
||||
There is one public function related to Futures. It is:
|
||||
There are some public functions related to Futures:
|
||||
|
||||
- ``async(arg)``. This takes an argument that is either a coroutine
|
||||
object or a Future (i.e., anything you can use with ``yield from``)
|
||||
and returns a Future. If the argument is a Future, it is returned
|
||||
unchanged; if it is a coroutine object, it wraps it in a Task
|
||||
(remember that ``Task`` is a subclass of ``Future``).
|
||||
|
||||
- ``wrap_future(future)``. This takes a PEP 3148 Future (i.e., an
|
||||
instance of ``concurrent.futures.Future``) and returns a Future
|
||||
|
|
Loading…
Reference in New Issue