PEP 317: Eliminate Implicit Exception Instantiation

Bernhard Herzog bh at intevation.de
Mon Jun 9 14:31:12 EDT 2003


Steven Taschuk <staschuk at telusplanet.net> writes:

> Quoth Bernhard Herzog:
>   [...]
> > How do I write code that raises and exception with an explicit traceback
> > object that works both with Python 2.4 and at least 2.3 (preferably 2.2
> > and 2.1 as well) and that does not issue warnings?
> 
> Not possible as the proposal stands (except, of course, by simply
> suppressing the warnings).

Suppressing it is pretty awkward because it happens at compile time so I
can't put the code to suppress it into the modules containing the
deprecated raise.

> This is a defect, but I couldn't come up with anything better when
> I was writing the PEP.

The easiest would be to introduce the new syntax with the future
statement in 2.4 and start issuing warnings several releases later.

I'd also recomment not issuing warnings about "raise SomeClass, val" in
2.4 either except perhaps when explicitly switched on. 

Warnings for string exceptions are fine with me, though.

> Part of my problem here is that I'm not
> familiar enough with real-life uses of the traceback argument.  Do
> you use it?

Yes, occasionally.

   Bernhard

-- 
Intevation GmbH                                 http://intevation.de/
Sketch                                 http://sketch.sourceforge.net/
MapIt!                                           http://www.mapit.de/




More information about the Python-list mailing list