[issue24697] Add CoroutineReturn and CoroutineExit builtin exceptions for coroutines

Yury Selivanov report at bugs.python.org
Thu Jul 23 20:28:10 CEST 2015


Yury Selivanov added the comment:

> What problem does this solve?

Only avoiding confusion, because coroutines now have a separate type, lack __iter__, and thus are quite different (on the surface) from generators. The fact that 'coro.send(..)' raises StopIteration (when coroutines aren't iterable), and that 'coro.close()' raises GeneratorExit might be confusing and non-obvious to some users.

FWIW I created this ticket mostly as a reminder for myself to have some discussion on this topic in the future, when 3.5 is released and we have some initial feedback on PEP 492 ideas.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24697>
_______________________________________


More information about the Python-bugs-list mailing list