best idiom for wide try/except net?
Lee Harr
missive at frontiernet.net
Thu Jun 19 18:06:37 EDT 2003
> The only workaround I've thought of is this, which looks a bit ugly to
> me (it seems a shame to have to explicitly catch stuff I don't want):
>
> try:
> # code that might have bugs
> except (SystemExit, KeyboardInterrupt):
> # exceptions I do not want to catch
> throw
> except:
> # all other exceptions
> sys.stderr.write(...)
> traceback.print_exc(file=sys.stderr)
>
> Any suggestions?
>
That seems pretty nice to me,
but I think you are looking for
raise instead of throw.
More information about the Python-list
mailing list