[Python-Dev] Py3k: Except clause syntax

Greg Ewing greg.ewing at canterbury.ac.nz
Sun Mar 19 02:49:57 CET 2006

Wolfgang Langner wrote:

> try:
>   something
> except NameError or OtherError as e:

I don't see that this really helps anything,
since it's no clearer how "or" and "as" should
bind than it is how "," and "as" should bind.

Also it has the disadvantage that

   except E1 or E2 as e:

would *not* be equivalent to

   except (E1 or E2) as e:

On the other hand, in

   except E1, E2 as e:

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

   except (E1, E2) as e:


More information about the Python-Dev mailing list