[Python-Dev] Py3k: Except clause syntax

Oleg Broytmann phd at mail2.phd.pp.ru
Fri Mar 17 21:23:45 CET 2006

On Fri, Mar 17, 2006 at 07:44:51PM +0000, John J Lee wrote:
> 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

   If parens are mandatory what is the difference from the current syntax?
Why do we need "as" here? Why not stay with

except (NameError, OtherError), e:


     Oleg Broytmann            http://phd.pp.ru/            phd at phd.pp.ru
           Programmers don't die, they just GOSUB without RETURN.

More information about the Python-Dev mailing list