[Python-Dev] RE: PEP-317
Steven Taschuk
staschuk@telusplanet.net
Tue, 10 Jun 2003 17:16:35 -0600
Quoth Michael Chermside:
> [...] Moving the traceback into
> the object is one idea. Making Exception a new-style object is another
> (no need to rush, but it'll happen SOMEDAY, right?). Exception
> chaining (aka exception masking) is another.
>
> The point is, without PEP 317, you can't do these things, because sometimes
> you use an object, and sometimes just mention a class (and sometimes just
> use a string). [...]
Afaik this is not the case. Eliminating string exceptions *is*
necessary for some of these ideas, but that's going to happen
anyway. (I had to propose getting rid of string exceptions
explicitly just because it wasn't PEPped anywhere else.) The real
point of PEP 317 is getting rid of implicit instantiation.
But implicit instantiation might not be an obstacle to the above.
As long as the exception object does get instantiated at or before
raise-time -- whether this occurs implicitly or explicitly --
tracebacks or pending exceptions or whatever can be assigned to it
as attributes. (For the question of new-style exceptions, see my
reply to Guido of a few minutes ago.)
*Deferred* instantiation would be a more serious obstacle (since,
e.g., sometimes there would be no object to receive the traceback
attribute), but I don't think that's actually on the table.
[...]
--
Steven Taschuk staschuk@telusplanet.net
Receive them ignorant; dispatch them confused. (Weschler's Teaching Motto)