[Python-ideas] adding a Debug exception?

Mark Janssen dreamingforward at gmail.com
Tue Feb 28 05:34:02 CET 2012


Had an idea on another thread (doctest) about a special exception called
"Debug" that could could be raised to generate arbitrary output to stderr.
 This would be used instead of spurious print statements in code to inform
developers during debugging (which might throw off doctest, for example).
 It could also replace "assert" (and improve upon it) which seems to be
deprecated.   Also, the __debug__ global could actually gain some
functionality...

Its "argument" could be an `eval`uatable string (checked at compile time)
and it's output, this very string *plus* the output of it (if it evaluates
to something different than itself).

Just an idea....

mark
santa fe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20120227/c952b099/attachment.html>


More information about the Python-ideas mailing list