[Python-checkins] r53486 - peps/trunk/pep-0352.txt
python-checkins at python.org
Thu Jan 18 20:22:34 CET 2007
Date: Thu Jan 18 20:22:33 2007
New Revision: 53486
Specify that the 'message' argument should be a string that is human-readable.
--- peps/trunk/pep-0352.txt (original)
+++ peps/trunk/pep-0352.txt Thu Jan 18 20:22:33 2007
@@ -86,13 +86,16 @@
The ``message`` attribute will contain either the first argument
passed in at instantiation of the object or the empty string if no
arguments were passed in. The attribute is meant to act as a common
-location to store any extra information that is to be passed along
-with the exception that goes beyond the location of the exception
-within the exception hierarchy and the exception's type.
-No restriction is placed upon what may be passed in for ``message``.
-This provides backwards-compatibility with how the arguments passed
-into Exception have no restrictions.
+location to store any message that is to be passed along
+with the exception that goes beyond the location of where the exception
+occurred and the exception's type.
+No restriction is placed upon what may be passed in for ``message``
+for backwards-compatibility reasons. In practice, though, only
+strings should be used. This keeps the string representation of the
+exception to be a useful message about the exception that is
+human-readable. Including programmatic information (e.g., an error
+code number) should be stored as a separate attribute in a subclass.
The ``args`` attribute is deprecated. While allowing multiple
arguments to be passed can be helpful, it is in no way essential. It
More information about the Python-checkins