<div dir="ltr"><div dir="ltr">> So I'm suggesting a new built-in debug() function as an easy and<br>> consistent way to write out debugging information.<br><div><div dir="ltr" class="gmail_signature"><div dir="ltr"><br></div><div dir="ltr">Python definitely needs a dedicated debug print command. Since</div><div>"debug" is take in 3.7, perhaps "debug.print" would work?</div><div><br></div><div>I've built python devtools with has such a command: </div><div><br></div><div><a href="https://github.com/samuelcolvin/python-devtools">https://github.com/samuelcolvin/python-devtools</a><br></div><div dir="ltr"><br></div><div>(I'm not trying to promote devtools, just demonstrate what is possible.)</div><div><br></div><div>The packge needs a little work but it's already extremely useful,</div><div>I use it all day every day.</div><div><br></div><div>A few things with devtools' debug does:</div><div>* pretty printing of objects (like pprint but IMHO clearer)</div><div>* coloured output of objects</div><div>* extra info about objects, eg. length, type etc.</div><div>* line numbers and function names where debug() was called</div><div>* names of the varible (or expression) which is being printed</div><div><br></div><div>It would be difficult to fully integrate a package like this into</div><div>the standard lib since it relies on pygments for colouring output,</div><div>but not impossible.</div><div><br></div><div>Is this the kind of thing you were thinking about?</div><div dir="ltr"><br>Samuel Colvin</div></div></div></div></div>