[Python-ideas] except expression

Jan Kaliszewski zuo at chopin.edu.pl
Fri Feb 14 00:37:42 CET 2014


My 3 cents (not proposed yet, AFAIK):


1. Simple Variant:

     get_it() except (IndexError: None)

2. Variant with 'as':

     get_it() except (OSError as exc: exc.errno)

3. Variant with multiple exceptions:

     get_it() except (FileNotFound: 0,
                      OSError as exc: exc.errno,
                      Exception: None)

Cheers.
*j



More information about the Python-ideas mailing list