[Python-ideas] except expression

Bruce Leban bruce at leapyear.org
Tue Feb 18 09:08:57 CET 2014


I think the idea of using commas for grouping in an except expression is a
bad idea.

To be clear when I say grouping what I mean is that as defined in the
proposal when the comma is omitted between two except clauses, they form
two separate except blocks and including the comma groups them into one.
Compare:

    A <except-clause1>, <except-clause2> <except-clause3>

    A <except-clause1> <except-clause2>, <except-clause3>

Here's color-coding to show the expressions we would have.

    A <except-clause1>, <except-clause2> <except-clause3>

    A <except-clause1> <except-clause2>, <except-clause3>

This is nothing like how commas are used anywhere else in the language. I
think it much better to use parenthesis for grouping:

    (A <except-clause1> <except-clause2>) <except-clause3>

    (A <except-clause1>) <except-clause2> <except-clause3>

--- Bruce
Learn how hackers think: http://j.mp/gruyere-security
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140218/ac18641d/attachment.html>


More information about the Python-ideas mailing list