pep-0492: Update Rationale section
This commit is contained in:
parent
ff91b78ea3
commit
9d82c29bd8
14
pep-0492.txt
14
pep-0492.txt
|
@ -38,15 +38,15 @@ Current Python supports implementing coroutines via generators (PEP
|
||||||
342), further enhanced by the ``yield from`` syntax introduced in PEP
|
342), further enhanced by the ``yield from`` syntax introduced in PEP
|
||||||
380. This approach has a number of shortcomings:
|
380. This approach has a number of shortcomings:
|
||||||
|
|
||||||
* it is easy to confuse coroutines with regular generators, since they
|
* It is easy to confuse coroutines with regular generators, since they
|
||||||
share the same syntax; async libraries often attempt to alleviate
|
share the same syntax; this is especially true for new developers.
|
||||||
this by using decorators (e.g. ``@asyncio.coroutine`` [1]_);
|
|
||||||
|
|
||||||
* it is not possible to natively define a coroutine which has no
|
* Whether or not a function is a coroutine is determined by a presence
|
||||||
``yield`` or ``yield from`` statements, again requiring the use of
|
of ``yield`` or ``yield from`` statements in its *body*, which can
|
||||||
decorators to fix potential refactoring issues;
|
lead to unobvious errors when such statements appear in or disappear
|
||||||
|
from function body during refactoring.
|
||||||
|
|
||||||
* support for asynchronous calls is limited to expressions where
|
* Support for asynchronous calls is limited to expressions where
|
||||||
``yield`` is allowed syntactically, limiting the usefulness of
|
``yield`` is allowed syntactically, limiting the usefulness of
|
||||||
syntactic features, such as ``with`` and ``for`` statements.
|
syntactic features, such as ``with`` and ``for`` statements.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue