Hello,

On Wed, 22 Apr 2015 13:31:18 -0700
Guido van Rossum <gu...@python.org> wrote:

> On Wed, Apr 22, 2015 at 1:10 PM, Andrew Svetlov
> <andrew.svet...@gmail.com> wrote:
> 
> > On Wed, Apr 22, 2015 at 10:44 PM, PJ Eby <p...@telecommunity.com>
> > wrote:
> > > On Tue, Apr 21, 2015 at 1:26 PM, Yury Selivanov
> > > <yselivanov...@gmail.com>
> > wrote:
> > >> It is an error to pass a regular context manager without
> > >> ``__aenter__`` and ``__aexit__`` methods to ``async with``.  It
> > >> is a ``SyntaxError`` to use ``async with`` outside of a
> > >> coroutine.
> > >
> > > I find this a little weird.  Why not just have `with` and `for`
> > > inside a coroutine dynamically check the iterator or context
> > > manager, and either behave sync or async accordingly?  Why must
> > > there be a *syntactic* difference?
> >
> > IIRC Guido always like to have different syntax for calling regular
> > functions and coroutines.
> > That's why we need explicit syntax for asynchronous context managers
> > and iterators.
> >
> 
> To clarify: the philosophy behind asyncio coroutines is that you
> should be able to tell statically where a task may be suspended
> simply by looking for `yield from`. This means that *no* implicit
> suspend points may exist, and it rules out gevent, stackless and
> similar microthreading frameworks.

I always wanted to ask - does that mean that Python could have
symmetric coroutines (in a sense that it would be Pythonic feature), as
long as the call syntax is different from a function call?

E.g.:

sym def coro1(val):
    while True:
        val = coro2.corocall(val)

sym def coro2(val):
    while True:
        val = coro1.corocall(val)

coro1.call(1)


-- 
Best regards,
 Paul                          mailto:pmis...@gmail.com
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to