[Python-Dev] Tidier Exceptions

Ka-Ping Yee python-dev at zesty.ca
Fri May 13 00:14:24 CEST 2005


It occurred to me as i was messing around with handling and re-raising
exceptions that tossing around these (type, value, traceback) triples
is irritating and error-prone.

How about just passing around a single value?  All we'd have to do is
put the traceback in value.traceback.

Implementation:

    - "raise Class" and "raise Class, string" automatically set
      the .traceback attribute on the new instance of Class.

    - "raise instance" automatically sets the .traceback attribute
      on the instance unless it already has one.

The behaviour of "except" and "sys.exc_*" could remain unchanged.
"raise t, v, tb" would eventually be deprecated in favour of "raise v".


-- ?!ng


More information about the Python-Dev mailing list