[Python-Dev] PEP 8: exception style

Robert Brewer fumanchu at amor.org
Sat Aug 6 18:33:05 CEST 2005

A.M. Kuchling 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?

I like the second form better, because even intermediate Pythonistas
sometimes make a mistake between:

	raise ValueError, A


	raise (ValueError, A)

I'd like to see the first form removed in Python 3k, to help reduce the
ambiguity. But PEP 8 taking a stand on it would be a good start for now.

Robert Brewer
System Architect
Amor Ministries
fumanchu at amor.org

More information about the Python-Dev mailing list