[SciPy-dev] adopting Python Style Guide for classes

Robert Kern robert.kern@gmail....
Wed Oct 3 15:07:54 CDT 2007


Perry Greenfield wrote:
> On Oct 3, 2007, at 3:16 PM, Robert Kern wrote:
> 
>> The warnings module allows one to filter warnings very  
>> specifically, down to the
>> line number in the module where the warning is issued. If you can  
>> catalog the
>> warnings that are raised by your application (say by running your  
>> test suite),
>> then you can filter out just those.
>>
> Yeah, I know, but the thing that wasn't obvious is which module is  
> listed when the error is raised.

It's the line that actually has warnings.warn() (or the location of the call to
the wrapper function that calls warnings.warn() if the wrapper function uses the
stacklevel argument; unfortunately, we can't use that to solve your problem
exactly).

> If the warning is raised in numpy,  
> isn't that the module it is associated with?

Yes.

> After all, how does it  
> know where in the call stack you really are interested in associating  
> that error with? Or does the warnings module see if that module you  
> have listed is in the call tree rather than the warning originating  
> in that module? From the PEP and online docs, it seems that module is  
> associated with the place the warning is raised. That would work ok,  
> but it means you turn it off for everything, not just your code, right?

Yes.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco


More information about the Scipy-dev mailing list