On 3/17/06, Georg Brandl <[EMAIL PROTECTED]> wrote:
> Brett Cannon wrote:
> > On 3/17/06, Georg Brandl <[EMAIL PROTECTED]> 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.
>
> I only think of consistency with the usage of "as" in the import statement.
> I know how it works, but I predict people will come and write
>
> except NameError as e, OtherError as f:
>

Really?  I don't.  'while' statement doesn't work that way either.  I
don't personally associate 'as' with any specific statement that uses
it.

Plus the above is bad since those should be separate 'except' clauses
if people need to differentiate between what exceptions they caught. 
Otherwise it should be ambiguous and assigned to a single variable
name.

-Brett
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to