[Python-ideas] except expression
Greg Ewing
greg.ewing at canterbury.ac.nz
Sun Feb 16 23:33:55 CET 2014
> On Mon, Feb 17, 2014 at 7:39 AM, Jan Kaliszewski <zuo at chopin.edu.pl> wrote:
>
>>Sorry, I don't catch the point. If I needed to use a complex
>>exception spec (a tuple-like) and/or a tuple as the "default"
>>expression -- I'd just do it:
>>
>> some_io() except (FileNotFoundError: (1, 2, 3),
>> (ValueError, TypeError): 'spam')
>>
>>I see no ambiguity here.
To make it parseable, it would probably be necessary to disallow
commas in the expression following the colon (i.e. it would
be a 'test' rather than a 'testlist' in terms of the grammar).
--
Greg
More information about the Python-ideas
mailing list