11PEP: 492
22Title: Coroutines with async and await syntax
3- Version: $Revision$
4- Last-Modified: $Date$
53Author: Yury Selivanov <yury@edgedb.com>
64Discussions-To: python-dev@python.org
75Status: Final
@@ -558,7 +556,7 @@ an asynchronous one. While this is not a very useful thing to do, the
558556code illustrates the relationship between regular and asynchronous
559557iterators.
560558
561- ::
559+ .. code:: python
562560
563561 class AsyncIteratorWrapper:
564562 def __init__(self, obj):
@@ -584,15 +582,15 @@ Why StopAsyncIteration?
584582Coroutines are still based on generators internally. So, before PEP
585583479, there was no fundamental difference between
586584
587- ::
585+ .. code:: python
588586
589587 def g1():
590588 yield from fut
591589 return 'spam'
592590
593591and
594592
595- ::
593+ .. code:: python
596594
597595 def g2():
598596 yield from fut
@@ -602,7 +600,7 @@ And since :pep:`479` is accepted and enabled by default for coroutines,
602600the following example will have its ``StopIteration`` wrapped into a
603601``RuntimeError``
604602
605- ::
603+ .. code:: python
606604
607605 async def a1():
608606 await fut
@@ -643,7 +641,7 @@ generators are treated as distinct concepts:
643641 doing so will result in a ``TypeError``.
644642
6456433. *generator-based coroutines* (for asyncio code must be decorated
646- with ``@asyncio.coroutine``) can ``yield from`` *native coroutine
644+ with ``@asyncio.coroutine`` [1]_ ) can ``yield from`` *native coroutine
647645 objects*.
648646
6496474. ``inspect.isgenerator()`` and ``inspect.isgeneratorfunction()``
@@ -1218,7 +1216,7 @@ Overall Impact
12181216This proposal introduces no observable performance impact. Here is an
12191217output of python's official set of benchmarks [4]_:
12201218
1221- ::
1219+ .. code:: text
12221220
12231221 python perf.py -r -b default ../cpython/python.exe ../cpython-aw/python.exe
12241222
@@ -1356,7 +1354,7 @@ Working example
13561354All concepts proposed in this PEP are implemented [3]_ and can be
13571355tested.
13581356
1359- ::
1357+ .. code:: python
13601358
13611359 import asyncio
13621360
@@ -1456,12 +1454,3 @@ Copyright
14561454=========
14571455
14581456This document has been placed in the public domain.
1459-
1460- ..
1461- Local Variables:
1462- mode: indented-text
1463- indent-tabs-mode: nil
1464- sentence-end-double-space: t
1465- fill-column: 70
1466- coding: utf-8
1467- End:
0 commit comments