easy verbose in functions

Timo Virkkala a at a.invalid
Mon Mar 29 04:58:19 EST 2004


Pascal wrote:
> Hello,
> 
> 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?

How about defining a function like:

def myprint(arg):
     if verbose:
         print arg

and using that?

--
Timo Virkkala



More information about the Python-list mailing list