Python style: exceptions vs. sys.exit()

Ross Ridge rridge at csclub.uwaterloo.ca
Wed Sep 24 14:24:13 EDT 2008


Steven D'Aprano <steven at REMOVE.THIS.cybersource.com.au> wrote:
> Presumably somebody has suggested that calling sys.exit() was a good 
> option. I'm curious to what possible reason they could give for such a 
> poor choice.

Grant Edwards  <invalid at invalid> wrote:
>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.

Ross Ridge <rridge at csclub.uwaterloo.ca> wrote:
> No, it's more like asking if the failed sensor should turn on
> a strange and mysterious light on the dashboard

Grant Edwards  <invalid at invalid> wrote:
>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.

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.

					Ross Ridge

-- 
 l/  //	  Ross Ridge -- The Great HTMU
[oo][oo]  rridge at csclub.uwaterloo.ca
-()-/()/  http://www.csclub.uwaterloo.ca/~rridge/ 
 db  //	  



More information about the Python-list mailing list