[Python-Dev] PEP 8: exception style

Michael Hudson mwh at python.net
Sun Aug 7 20:05:03 CEST 2005

Guido van Rossum <gvanrossum at gmail.com> writes:

> On 8/6/05, A.M. Kuchling <amk at amk.ca> wrote:
>> PEP 8 doesn't express any preference between the
>> two forms of raise statements:
>> raise ValueError, 'blah'
>> raise ValueError("blah")
>> I like the second form better, because if the exception arguments are
>> long or include string formatting, you don't need to use line
>> continuation characters because of the containing parens.  Grepping
>> through the library code, the first form is in the majority, used
>> roughly 60% of the time.
>> Should PEP 8 take a position on this?  If yes, which one?
> Definitely ValueError('blah'). The other form will go away in Python
> 3000. Please update the PEP.

How do you then supply a traceback to the raise statement?


  please realize that the Common  Lisp community is more than 40
  years old.  collectively, the community has already been where
  every clueless newbie  will be going for the next three years.
  so relax, please.                     -- Erik Naggum, comp.lang.lisp

More information about the Python-Dev mailing list