Steve Holden <st***@holdenweb.comwrites:
Ben Finney wrote:
[...]
A 'try ... except' statement is not an exception handler. [...]
Just as a matter of interest, what would your definition of an
exception handler be, then? Specifically, what's the "except" clause
for?
It seems my understanding was wrong. The 'except' clause *is* an
exception handler. (I was thinking that the "default exception
handler" was the only thing that could be called an "exception
handler".) It's explained better here:
<URL:http://docs.python.org/ref/try.html>
The docs for looging.except should make it explicit that the
exception will be re-raised.
Yes, I agree; it wasn't very clear on reading the description of
'logging.exception()' what would actually happen.
Of course it might be possible to do something hackish like
try:
...
except:
try:
logging.exception(...)
except:
pass
which (although untested) should theoretically allow the catching
(for a second time) of teh exception reraised by
logging.exception().
It does seem rather a side effect, and an unexpected (and
undocumented) one at that.
--
\ "If it ain't bust don't fix it is a very sound principle and |
`\ remains so despite the fact that I have slavishly ignored it |
_o__) all my life." -- Douglas Adams |
Ben Finney