diff options
author | Michael W. Hudson <mwh@python.net> | 2005-03-04 14:33:32 (GMT) |
---|---|---|
committer | Michael W. Hudson <mwh@python.net> | 2005-03-04 14:33:32 (GMT) |
commit | a2a9888f22a7811938d2f708344e01dfc000841c (patch) | |
tree | a42cfe774d57c4ba8c87734b27979be32a437edb /Doc/ref/ref4.tex | |
parent | c72dd38f30eb034f33e5efa1029ed17ca773d267 (diff) | |
download | cpython-a2a9888f22a7811938d2f708344e01dfc000841c.zip cpython-a2a9888f22a7811938d2f708344e01dfc000841c.tar.gz cpython-a2a9888f22a7811938d2f708344e01dfc000841c.tar.bz2 |
Updates to the exceptions documentation (this is my patch #1156102).
Diffstat (limited to 'Doc/ref/ref4.tex')
-rw-r--r-- | Doc/ref/ref4.tex | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/Doc/ref/ref4.tex b/Doc/ref/ref4.tex index dbd6a2f..6a3a4ef 100644 --- a/Doc/ref/ref4.tex +++ b/Doc/ref/ref4.tex @@ -182,16 +182,20 @@ either case, it prints a stack backtrace, except when the exception is \exception{SystemExit}\withsubitem{(built-in exception)}{\ttindex{SystemExit}}. -Exceptions are identified by class instances. -Selection of a matching except clause is based on object identity. -The \keyword{except} clause must reference the same class or a base -class of it. - -When an exception is raised, an object (maybe \code{None}) is passed -as the exception's \emph{value}; this object does not affect the -selection of an exception handler, but is passed to the selected -exception handler as additional information. For class exceptions, -this object must be an instance of the exception class being raised. +Exceptions are identified by class instances. The \keyword{except} +clause is selected depending on the class of the instance: it must +reference the class of the instance or a base class thereof. The +instance can be received by the handler and can carry additional +information about the exceptional condition. + +Exceptions can also be identified by strings, in which case the +\keyword{except} clause is selected by object identity. An arbitrary +value can be raised along with the identifying string which can be +passed to the handler. + +\deprecated{2.5}{String exceptions should not be used in new code. +They will not be supported in a future version of Python. Old code +should be rewritten to use class exceptions instead.} \begin{notice}[warning] Messages to exceptions are not part of the Python API. Their contents may |