[Python-ideas] except expression
Chris Angelico
rosuav at gmail.com
Sun Feb 16 23:19:22 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.
Maybe not, but the only thing preventing that from parsing as a tuple
containing two tuples is the colon a bit further along. That might be
sufficient for the lexer (in the same way that, for instance, function
arguments can contain tuples), but I suspect it may be confusing for
humans.
ChrisA
More information about the Python-ideas
mailing list