[Python-Dev] Py3k: Except clause syntax (original) (raw)
Brett Cannon brett at python.org
Fri Mar 17 22:08:19 CET 2006
- Previous message: [Python-Dev] Py3k: Except clause syntax
- Next message: [Python-Dev] Py3k: Except clause syntax
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 3/17/06, Georg Brandl <g.brandl at gmx.net> wrote:
John J Lee wrote:
>> In your formulation the comma binds more tightly than the as keyword. >> In import statements it's the other way around. That seems like it >> might be a source of confusion. > > Perhaps parentheses around the exception list should be mandatory for the > 2-or-more exceptions case? > > except NameError as e: --> fine > except (NameError) as e: --> fine > except (NameError,) as e: --> fine > > except NameError, OtherError as e: --> SyntaxError > except (NameError, OtherError) as e: --> fine I don't like that particularly, but I guess that for consistency's sake it would have to be done this way.
I don't like it period. What consistency problem is there? This is Python 3 we are talking about, so if something makes good sense such as not having parentheses, I say leave them off. There are multiple places where parens could be required but are not, like multiple assignment.
-Brett
- Previous message: [Python-Dev] Py3k: Except clause syntax
- Next message: [Python-Dev] Py3k: Except clause syntax
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]