Record BDFL opinion on exception-raising style

This commit is contained in:
Andrew M. Kuchling 2005-08-07 13:27:54 +00:00
parent cbbce90c40
commit ac8c835cce
1 changed files with 7 additions and 0 deletions

View File

@ -546,6 +546,13 @@ Programming Recommendations
class MessageError(Exception):
"""Base class for errors in the email package."""
When raising an exception, use "raise ValueError('message')"
instead of the older form "raise ValueError, 'message'". The
paren-using form is preferred because when the exception
arguments are long or include string formatting, you don't need
to use line continuation characters thanks to the containing
parentheses. The older form will be removed in Python 3000.
- Use string methods instead of the string module unless
backward-compatibility with versions earlier than Python 2.0 is
important. String methods are always much faster and share the