Generators and propagation of exceptions

Ethan Furman ethan at stoneleaf.us
Fri Apr 8 14:41:51 EDT 2011


r wrote:
> The code above implements an interactive session (a REPL). Therefore,
> what I'd like to get is an error information printed out at the output
> as soon as it becomes available.

Couple ideas:

1) Instead of yielding the error, call some global print function, then 
continue on; or

2) Collect the errors, then have the top-most consumer check for errors 
and print them out before reading the next generator output.

~Ethan~



More information about the Python-list mailing list