[Python-checkins] peps: pep-0492: 'Why not reuse existing "for" and "with"...' section

yury.selivanov python-checkins at python.org
Thu Apr 23 21:53:29 CEST 2015


https://hg.python.org/peps/rev/6284d8e240c5
changeset:   5790:6284d8e240c5
user:        Yury Selivanov <yselivanov at sprymix.com>
date:        Thu Apr 23 15:53:20 2015 -0400
summary:
  pep-0492: 'Why not reuse existing "for" and "with"...' section

files:
  pep-0492.txt |  14 ++++++++++++--
  1 files changed, 12 insertions(+), 2 deletions(-)


diff --git a/pep-0492.txt b/pep-0492.txt
--- a/pep-0492.txt
+++ b/pep-0492.txt
@@ -754,13 +754,13 @@
 6. Requiring parentheses grammatically also introduces a whole lot
    of new problems.
 
-   Code like the following::
+   The following code::
 
        await fut
        await function_returning_future()
        await asyncio.gather(coro1(arg1, arg2), coro2(arg1, arg2))
 
-    would look like::
+   would look like::
 
        cocall fut()  # or cocall costart(fut)
        cocall (function_returning_future())()
@@ -951,6 +951,16 @@
   simple and foolproof as possible.
 
 
+Why not reuse existing "for" and "with" statements
+--------------------------------------------------
+
+The vision behind existing generator-based coroutines and this proposal
+is to make it easy for users to see where the code might be suspended.
+Making existing "for" and "with" statements to recognize asynchronous
+iterators and context managers will inevitable create invisible
+implicit suspend points, making it harder to reason about the code.
+
+
 Comprehensions
 --------------
 

-- 
Repository URL: https://hg.python.org/peps


More information about the Python-checkins mailing list