[Python-Dev] Re: PEP-317

Steven Taschuk staschuk@telusplanet.net
Mon, 9 Jun 2003 12:51:47 -0600


Quoth Raymond Hettinger:
  [...]
> That brings up the question of whether the warnings are a 
> runtime or compile time event.  Can you always determine
> at compile time whether raise Class is being used?  If not,
> the performance penalty for the warnings module is something
> else to consider.

As the PEP says, the warning about using three arguments is issued
at compile-time, while the others are at run-time, in keeping with
when the corresponding future errors would occur.

The performance penalty of the warnings is a legitimate concern,
but I don't expect it to be a serious problem:

1. The compile-time warning is, well, issued at compile time,
which is not usually on a performance-critical path.

2. The run-time warnings are issued when raising an exception;
also not usually on a performance-critical path.  (Except for
things like StopIteration.  But the PEP does not propose any
change to the C API, so the built-in iterators won't be affected.)

-- 
Steven Taschuk                                     staschuk@telusplanet.net
Receive them ignorant; dispatch them confused.  (Weschler's Teaching Motto)