PEP 492: Resolve unreferenced footnotes (#3241)
This commit is contained in:
parent
8be3570b06
commit
315f2ceb95
25
pep-0492.txt
25
pep-0492.txt
|
@ -1,7 +1,5 @@
|
||||||
PEP: 492
|
PEP: 492
|
||||||
Title: Coroutines with async and await syntax
|
Title: Coroutines with async and await syntax
|
||||||
Version: $Revision$
|
|
||||||
Last-Modified: $Date$
|
|
||||||
Author: Yury Selivanov <yury@edgedb.com>
|
Author: Yury Selivanov <yury@edgedb.com>
|
||||||
Discussions-To: python-dev@python.org
|
Discussions-To: python-dev@python.org
|
||||||
Status: Final
|
Status: Final
|
||||||
|
@ -558,7 +556,7 @@ an asynchronous one. While this is not a very useful thing to do, the
|
||||||
code illustrates the relationship between regular and asynchronous
|
code illustrates the relationship between regular and asynchronous
|
||||||
iterators.
|
iterators.
|
||||||
|
|
||||||
::
|
.. code:: python
|
||||||
|
|
||||||
class AsyncIteratorWrapper:
|
class AsyncIteratorWrapper:
|
||||||
def __init__(self, obj):
|
def __init__(self, obj):
|
||||||
|
@ -584,7 +582,7 @@ Why StopAsyncIteration?
|
||||||
Coroutines are still based on generators internally. So, before PEP
|
Coroutines are still based on generators internally. So, before PEP
|
||||||
479, there was no fundamental difference between
|
479, there was no fundamental difference between
|
||||||
|
|
||||||
::
|
.. code:: python
|
||||||
|
|
||||||
def g1():
|
def g1():
|
||||||
yield from fut
|
yield from fut
|
||||||
|
@ -592,7 +590,7 @@ Coroutines are still based on generators internally. So, before PEP
|
||||||
|
|
||||||
and
|
and
|
||||||
|
|
||||||
::
|
.. code:: python
|
||||||
|
|
||||||
def g2():
|
def g2():
|
||||||
yield from fut
|
yield from fut
|
||||||
|
@ -602,7 +600,7 @@ And since :pep:`479` is accepted and enabled by default for coroutines,
|
||||||
the following example will have its ``StopIteration`` wrapped into a
|
the following example will have its ``StopIteration`` wrapped into a
|
||||||
``RuntimeError``
|
``RuntimeError``
|
||||||
|
|
||||||
::
|
.. code:: python
|
||||||
|
|
||||||
async def a1():
|
async def a1():
|
||||||
await fut
|
await fut
|
||||||
|
@ -643,7 +641,7 @@ generators are treated as distinct concepts:
|
||||||
doing so will result in a ``TypeError``.
|
doing so will result in a ``TypeError``.
|
||||||
|
|
||||||
3. *generator-based coroutines* (for asyncio code must be decorated
|
3. *generator-based coroutines* (for asyncio code must be decorated
|
||||||
with ``@asyncio.coroutine``) can ``yield from`` *native coroutine
|
with ``@asyncio.coroutine`` [1]_) can ``yield from`` *native coroutine
|
||||||
objects*.
|
objects*.
|
||||||
|
|
||||||
4. ``inspect.isgenerator()`` and ``inspect.isgeneratorfunction()``
|
4. ``inspect.isgenerator()`` and ``inspect.isgeneratorfunction()``
|
||||||
|
@ -1218,7 +1216,7 @@ Overall Impact
|
||||||
This proposal introduces no observable performance impact. Here is an
|
This proposal introduces no observable performance impact. Here is an
|
||||||
output of python's official set of benchmarks [4]_:
|
output of python's official set of benchmarks [4]_:
|
||||||
|
|
||||||
::
|
.. code:: text
|
||||||
|
|
||||||
python perf.py -r -b default ../cpython/python.exe ../cpython-aw/python.exe
|
python perf.py -r -b default ../cpython/python.exe ../cpython-aw/python.exe
|
||||||
|
|
||||||
|
@ -1356,7 +1354,7 @@ Working example
|
||||||
All concepts proposed in this PEP are implemented [3]_ and can be
|
All concepts proposed in this PEP are implemented [3]_ and can be
|
||||||
tested.
|
tested.
|
||||||
|
|
||||||
::
|
.. code:: python
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
|
|
||||||
|
@ -1456,12 +1454,3 @@ Copyright
|
||||||
=========
|
=========
|
||||||
|
|
||||||
This document has been placed in the public domain.
|
This document has been placed in the public domain.
|
||||||
|
|
||||||
..
|
|
||||||
Local Variables:
|
|
||||||
mode: indented-text
|
|
||||||
indent-tabs-mode: nil
|
|
||||||
sentence-end-double-space: t
|
|
||||||
fill-column: 70
|
|
||||||
coding: utf-8
|
|
||||||
End:
|
|
||||||
|
|
Loading…
Reference in New Issue