2014-11-28 3:49 GMT+01:00 Nick Coghlan <ncogh...@gmail.com>: > I think between contextlib and Trollius, the case is starting to be > made for raising an UnhandledStopIteration subclass of RuntimeError, > rather than a generic RuntimeError.
I modified Trollius to test such idea: * Return inherits from Exception (not from StopIteration) * on Python 3, @trollius.coroutine wraps the coroutine to catch Runtimerror: if the exc.__context__ is a StopIteration, return exc.__context__.value The test suite pass with such additional coroutine wrapper on Python 3.5 patched with pep479.patch (and unpatched Python 3.3). So yes, it may help to have a new specialized exception, even if "it works" with RuntimeError. The drawback is that a new layer would make trollius even slower. Victor _______________________________________________ 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