Message124845
| Author |
ncoghlan |
| Recipients |
draghuram, eric.araujo, ethan.furman, mrabarnett, ncoghlan, pitrou, poke, rhettinger, steven.daprano |
| Date |
2010年12月29日.08:46:55 |
| SpamBayes Score |
1.9777817e-06 |
| Marked as misclassified |
No |
| Message-id |
<1293612418.9.0.877068183634.issue6210@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
No, the context must always be included unless explicitly suppressed. The interpreter can't reliably tell the difference between a raise statement in the current exception handler and one buried somewhere inside a nested function call. The whole point is to give developers a hint as to how to trigger the broken error handling code, which only works if the default behaviour is to provide the additional information.
Being able to suppress the context *is* a valid feature request, but one that will now need to wait until Python 3.3. In the meantime, sys.excepthook + the traceback module + PYTHONSTARTUP allows individual users to modify the interactive prompt to exhibit whatever exception display behaviour they like, and applications can do the same thing in their __main__module (likely via a context manager retrieved from a utility module). |
|