[Python-ideas] Debugging: some problems and possible solutions

Rhodri James rhodri at kynesim.co.uk
Mon Oct 8 09:15:35 EDT 2018


On 04/10/18 19:10, Jonathan Fine wrote:
> In response to my problem-solution pair (fixing a typo)
>> TITLE: Debug print() statements cause doctests to fail
> 
> Rhodri James wrote:
>> Or write your debug output to stderr?
> 
> Perhaps I've been too concise. If so, I apologise. My proposal is that
> the system be set up so that
>      debug(a, b, c)
> sends output to the correct stream, whatever it should be.
> 
> Rhodri:  Thank you for your contribution. Are you saying that because
> the developer can write
>      print(a, b, c, file=sys.stderr)
> there's not a problem to solve here?

Exactly so.  If you want a quick drop of debug information, print() will 
do that just fine.  If you want detailed or tunable information, that's 
what the logging module is for.  I'm not sure where on the line between 
the two your debug() sits and what it's supposed to offer that is better 
than either of the alternatives.

-- 
Rhodri James *-* Kynesim Ltd


More information about the Python-ideas mailing list