[Python-ideas] adding a Debug exception?

Ned Batchelder ned at nedbatchelder.com
Tue Feb 28 13:17:52 CET 2012


On 2/27/2012 11:34 PM, Mark Janssen wrote:
> 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...
>
Raising an exception to generate a log message?  You'd never execute the 
statement after the raise, completely destroying the flow of the code.  
Perhaps this idea needs a little more thought...  Have you looked into 
the logging module?

--Ned.
>
> mark
> santa fe
>
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20120228/a1681fdf/attachment.html>


More information about the Python-ideas mailing list