[Numpy-discussion] Getting rid of annoying weave nag

Tim Hochberg tim.hochberg at cox.net
Fri Jun 9 16:55:53 CDT 2006


David M. Cooke wrote:

>On Fri, 9 Jun 2006 15:19:14 -0600
>"Fernando Perez" <fperez.net at gmail.com> wrote:
>
>  
>
>>On 6/9/06, David M. Cooke <cookedm at physics.mcmaster.ca> wrote:
>>    
>>
>>>On Thu, Jun 08, 2006 at 11:28:04PM -0600, Fernando Perez wrote:
>>>      
>>>
>>>>Anyone object to this patch against current numpy SVN to get rid of
>>>>this thing? (tracking where the hell that thing was coming from was
>>>>all kinds of fun)
>>>>        
>>>>
>>>Go ahead.
>>>
>>>I'm against random messages being printed out anyways -- I'd get
>>>rid of the '<weave: compiling>' too. There's a bunch of code in scipy
>>>with 'print' statements that I don't think belong in a library. (Now,
>>>if we defined a logging framework, that'd be ok with me!)
>>>      
>>>
>>Before I commit anything, let's decide on that one.  Weave used to
>>print 'None' whenever it compiled anything, I changed it a while ago
>>to the current 'weave:compiling'.  I'm also of the opinion that
>>libraries should operate quietly, but with weave I've always wanted
>>that message in there.  The reason is that when weave compiles (esp.
>>with blitz in the picture), the execution takes a long time.  The same
>>function goes from miliseconds to 30 seconds of run time depending on
>>whether compilation is happening or not.
>>
>>This difference is so dramatic that I think a message is justified
>>(absent a proper logging framework).  It's helpful to know that the
>>time is going into c++ compilation, and not your code hanging for 30
>>seconds.
>>    
>>
>
>Ok, I'll give you that one :-) It's the other 1000 uses of print that I'm
>concerned about.
>
>inline_tools.compile_function takes a verbose flag, though, which eventually
>gets passed to build_tools.build_extension (which I believe does all the
>compiling for weave). It's probably more reasonable to have
>inline_tools.compile_function default to verbose=1 instead of 0, then
>build_extension will print 'Compiling code...' (that should be changed to
>mention weave).
>  
>

Assuming inline_tools doesn't already use logging, might it be 
advantageous to have it use Python's logging module?

 >>> logging.getLogger("scipy.weave").warning("compiling -- this may 
take some time")
WARNING:scipy.weave:compiling -- this may take some time

[I think warning is the lowest level that gets displayed by default]

-tim







More information about the Numpy-discussion mailing list