Re: Python style: exceptions vs. sys.exit()
Grant Edwards <invalid@invali dwrote:
Ross Ridge <rridge@csclub. uwaterloo.cawro te:
Grant Edwards <invalid@invali dwrote:
Ross Ridge a écrit :
Bruno Desthuilliers <bdesth.quelque chose@free.quel quepart.frwrote :
Of course not. Plenty of people were quick to say that the exception
should be passed through to the caller. No one said this behaviour
should be documented. There may be little practical difference bewteen
calling sys.exit() after printing an error and progating an exception
if no one using the library knows that it could generate that exception
in those circumstances.
Ross Ridge
--
l/ // Ross Ridge -- The Great HTMU
[oo][oo] rridge@csclub.u waterloo.ca
-()-/()/ http://www.csclub.uwaterloo.ca/~rridge/
db //
Grant Edwards <invalid@invali dwrote:
Same here. It's like an automotive engine controls designer
asking if a failed O2 sensor should turn on the check engine
light or blow up the car.
asking if a failed O2 sensor should turn on the check engine
light or blow up the car.
No, it's more like asking if the failed sensor should turn on
a strange and mysterious light on the dashboard
a strange and mysterious light on the dashboard
You're right. I had forgotten that sys.exit() is actually
raising the system exit exception, and that the application
calling the library could handle that exception.
raising the system exit exception, and that the application
calling the library could handle that exception.
Well, my point was that exceptions in Python are a bit like a car's
check engine light. Few drivers know what this mysterious light means,
and aren't prepared to do anything about it when it goes on.
check engine light. Few drivers know what this mysterious light means,
and aren't prepared to do anything about it when it goes on.
>You're kidding, aren't you ?
should be passed through to the caller. No one said this behaviour
should be documented. There may be little practical difference bewteen
calling sys.exit() after printing an error and progating an exception
if no one using the library knows that it could generate that exception
in those circumstances.
Ross Ridge
--
l/ // Ross Ridge -- The Great HTMU
[oo][oo] rridge@csclub.u waterloo.ca
-()-/()/ http://www.csclub.uwaterloo.ca/~rridge/
db //
Comment