easy verbose in functions

Miki Tebeka miki.tebeka at zoran.com
Mon Mar 29 06:49:01 EST 2004


Hello Pascal,

> I've a function like this:
> def myfunction(data, verbose = False):
>    dothis...
>    if verbose: print 'I do this'
>    dothisother
>    if verbose: print 'I do this other'
>    ...
> 
> How can I do to exclude eachtime the `if verbose` statement?
> 
> I tried `print verbose and 'I do this'` but it's printing `False`.
> So I tried with `verbose = None` in the definition, but it's printing None!
Try the logging package?

HTH.
Miki



More information about the Python-list mailing list