[Python-ideas] except expression

Paul Moore p.f.moore at gmail.com
Mon Feb 17 08:43:08 CET 2014


On 17 February 2014 04:46, Steven D'Aprano <steve at pearwood.info> wrote:
>> >     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.
>
> It's certainly confusing for me!

Just as a data point - with my eyesight and the monitor
resolution/font I use, I can't even *see* the colon without squinting.
There's an old principle "new syntax should not look like grit on
Tim's monitor" that probably applies here :-)

Paul


More information about the Python-ideas mailing list