13 Feb
2014
13 Feb
'14
9:31 p.m.
Nick Coghlan wrote:
"if" would be better, but, as you already noted, poses significant parsing challenges (since it likely wouldn't be easy to require that ternary expressions use parentheses in this new construct, but still allow the parentheses to be omitted in the general case).
I don't think that would be an insurmountable difficulty. The if-expression appears at the 'test' level in the grammar, so all it should take is for the expression following 'except' to be something lower, such as an 'or_test'. There are precedents for this kind of thing, e.g. yield expressions can appear unparenthesised in some contexts but not others. -- Greg