> So I'm suggesting a new built-in debug() function as an easy and
> consistent way to write out debugging information.

Python definitely needs a dedicated debug print command. Since
"debug" is take in 3.7, perhaps "debug.print" would work?

I've built python devtools with has such a command: 


(I'm not trying to promote devtools, just demonstrate what is possible.)

The packge needs a little work but it's already extremely useful,
I use it all day every day.

A few things with devtools' debug does:
* pretty printing of objects (like pprint but IMHO clearer)
* coloured output of objects
* extra info about objects, eg. length, type etc.
* line numbers and function names where debug() was called
* names of the varible (or expression) which is being printed

It would be difficult to fully integrate a package like this into
the standard lib since it relies on pygments for colouring output,
but not impossible.

Is this the kind of thing you were thinking about?

Samuel Colvin