Python Error message
Chris Angelico
rosuav at gmail.com
Thu Aug 4 15:53:29 EDT 2016
On Fri, Aug 5, 2016 at 5:36 AM, Terry Reedy <tjreedy at udel.edu> wrote:
> An example of the latter is when one writes code in Python to execute
> 'other' code. (IDLE is one example. It both executes user statements and
> evals user expressions.) One needs "except BaseException:" to isolate the
> interpreter from exceptions raised in the interpreted code. (It would be
> wrong for IDLE to stop because a user submitted code that raises, whether
> intentionally or accidentally) A 'raise' that throws the exception into the
> interpreter is likely the worst thing to do.
This is a classic example of a "boundary location". Another extremely
common example is a web server: if an exception bubbles out of a
request handler function, the outer wrapper code should catch that,
log it, and send a 500 back to the client.
But none of this is what the OP is doing.
ChrisA
More information about the Python-list
mailing list