[Python-Dev] Py3k: Except clause syntax

Brett Cannon brett at python.org
Fri Mar 17 04:30:01 CET 2006


On 3/16/06, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Baptiste Carvello wrote:
>
> > what about
> >
> >      except <type> with <value>:
> >
> > a program dies "with" an error message, not "as" an error message.
>
> No. The exception object you're catching *is* the value,
> not something which *has* a value. I maintain that "as"
> is the correct word to use here.

I agree.  "as" is taking on the use of assignment in statements that
are not ``=`` and I say we just keep on with that.  Plus Greg's above
explanation also makes sense to me; you are binding the exception to a
name and treating as if it was called <value>.

-Brett


More information about the Python-Dev mailing list