[Python-Dev] Requesting pronouncement on PEP 463: Exception-catching expressions

Paul Moore p.f.moore at gmail.com
Wed Mar 12 17:21:35 CET 2014


On 12 March 2014 16:05, Chris Angelico <rosuav at gmail.com> wrote:
> Tooling issues should already have been solved for lambda, but if you
> don't like the colon, go with one of the other options - Brett
> expressed support for 'then', which makes very good sense (it does
> require creating a new keyword, but it's a fairly safe one).

As a data point, Vim's syntax highlighting works mostly fine out of
the box for the "top 4" proposed syntaxes. The keyword versions have
minor issues - "then" is not highlighted at all and "pass" is
highlighted as "pythonStatement" which is slightly jarring. The
punctuation-based variants just don't highlight the ":" or "->" which
is fine. Making "then" a keyword in Vim's syntax wouldn't be too hard,
you'd probably put it in class "pythonException" along with except,
try, finally and raise (which seems a bit odd, but that's actually the
only place then is used as a keyword, so it's right). Making "pass"
highlight as a statement when used standalone or as an expression
keyword in an except would be tricky (i.e., I wouldn't know how to do
it :-))

The highlighting issue is jarring enough to put me off the "pass" option.

Paul


More information about the Python-Dev mailing list