[Python-ideas] asyncore: included batteries don't fit
Greg Ewing
greg.ewing at canterbury.ac.nz
Tue Oct 9 11:11:43 CEST 2012
Ben Darnell wrote:
> StackContext doesn't quite give you better tracebacks, although I
> think it could be adapted to do that. ExceptionStackContext is
> essentially a try/except block that follows you around across
> asynchronous operations - on entry it sets a thread-local state, and
> all the tornado asynchronous functions know to save this state when
> they are passed a callback, and restore it when they execute it.
This is something that generator-based coroutines using
yield-from ought to handle a lot more cleanly. You should
be able to just use an ordinary try-except block in your
generator code and have it do the right thing.
I hope that the new async core will be designed so that
generator-based coroutines can be plugged into it directly
and efficiently, without the need for a lot of decorators,
callbacks, Futures, etc. in between.
--
Greg
More information about the Python-ideas
mailing list