On 2018-06-05 18:25, Kyle Lahnakoski wrote:
I currently use the form
<control_flag> and log_function( <msg_expr> )
where <control_flag> is some module variable, usually "DEBUG". I do
this because it is one line, and it ensures the log_function parameters
are not evaluated.
You'd get the same result with:
if <control_flag>: log_function( <msg_expr> )
*IF* runtime assertions had a switch so they have no overhead when not
active, how much faster can it get? How expensive is the <control_flag>
check?
On 2018-05-10 03:55, Barry Scott wrote:
My logging example would be
log( control_flag, msg_expr )
expanding to:
if <control_flag>:
log_function( <msg_expr> )
Barry
This idea requires the same sort of machinery in python that I was
hoping for to implement the short circuit logging.
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/