A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2006-March/062614.html below:

[Python-Dev] Py3k: Except clause syntax

[Python-Dev] Py3k: Except clause syntaxskip at pobox.com skip at pobox.com
Sun Mar 19 04:47:17 CET 2006
    Greg> On the other hand, in

    Greg>    except E1, E2 as e:

    Greg> the E1, E2 is just a tuple expression, so it's
    Greg> exactly equivalent to

    Greg>    except (E1, E2) as e:

The comma and "as" have different precedence in your proposed except clause
than they currently do in the import statement.  I think that can lead to
confusion.  In particular, if someone is used to

    from foo import bar, baz as flurp

I think they might expect that in this try/except statement:

    try:
        something()
    except E1, E2 as e
        print "something bad happened"

if E1 is raised, e will not be (re)bound, but if E2 is raised, then it will
be.  I know Python is not as heavily an operator-oriented language as C or
Perl, but I think it makes sense to maintain the same relative binding
precedence between operators in different contexts wherever possible.

There seem to be other places where Python is beginning to require parens
even though they aren't strictly necessary to resolve syntactic ambiguity.
This might be one of them.

Skip
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4