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
|
||||
380. This approach has a number of shortcomings:
|
||||
|
||||
* it is easy to confuse coroutines with regular generators, since they
|
||||
share the same syntax; async libraries often attempt to alleviate
|
||||
this by using decorators (e.g. ``@asyncio.coroutine`` [1]_);
|
||||
* It is easy to confuse coroutines with regular generators, since they
|
||||
share the same syntax; this is especially true for new developers.
|
||||
|
||||
* it is not possible to natively define a coroutine which has no
|
||||
``yield`` or ``yield from`` statements, again requiring the use of
|
||||
decorators to fix potential refactoring issues;
|
||||
* Whether or not a function is a coroutine is determined by a presence
|
||||
of ``yield`` or ``yield from`` statements in its *body*, which can
|
||||
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
|
||||
syntactic features, such as ``with`` and ``for`` statements.
|
||||
|
||||
|
|
Loading…
Reference in New Issue