[Python-Dev] Traceback problem
Kevin Jacobs
jacobs@penguin.theopalgroup.com
Mon, 24 Feb 2003 22:24:26 -0500 (EST)
On Tue, 25 Feb 2003, Christian Tismer wrote:
> > You and Kevin Jacobs can argue about the syntax.
>
> Proposals, in decreasing orders of delight:
>
> 1) Implement exeptions according to the documentation.
> Cleaning exceptions after they are handled is what
> most users would expect, last but not least since
> the documentation suggests it.
This is not a practical option -- while I don't think the current behavior
is ideal, we have a great deal of code that relies on this behavior. I'm
sure that many other Python developers are in the same boat. If this is to
change, we need to do a lot more work to justify it, and to give at least
full one version of notice before enforcing it.
> 2) Add an optional boolean clear argument to sys.exc_info()
> This is lame, but it gives the user one way out.
exc_info(...)
exc_info() -> (type, value, traceback)
Return information about the exception that is currently being handled.
This should be called from inside an except clause only.
Adding an argument to this function reeks of a kludge. Its job is to return
information, and should not take any magic arguments to make it a
'one-shot'.
> 3) Add an extra reset_exp function to sys.
> More lame since it requires an extra function,
> just to patch a "feature".
This one gets my vote (if this were a democracy). "Explicit is better than
implicit". The new symbol in the sys namespace also makes it easy to test
for the capability (without a version number check). Maybe it should be
called 'clear_exc' or 'reset_exc_info' (to match the C API name).
> 4) Keep things as they are, and expect the Spanish Inquision.
I'm even okay with the status quo and can continue to use my current hack to
clear exception data.
Regards,
-Kevin
--
--
Kevin Jacobs
The OPAL Group - Enterprise Systems Architect
Voice: (216) 986-0710 x 19 E-mail: jacobs@theopalgroup.com
Fax: (216) 986-0714 WWW: http://www.theopalgroup.com