[Python-ideas] except expression

Chris Angelico rosuav at gmail.com
Tue Feb 18 00:49:32 CET 2014


On Tue, Feb 18, 2014 at 7:50 AM, Steven D'Aprano <steve at pearwood.info> wrote:
> Brackets around the ValueError, TypeError pair might be allowed:
>
>     (some_io() except FileNotFoundError: (1, 2, 3),
>                except (ValueError, TypeError): 'spam')

I'd say that the parens are definitely allowed, and might be required.
(They're currently required in the statement form, but I think that's
just to distinguish from the old pre-'as' syntax.)

ChrisA


More information about the Python-ideas mailing list