This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Lluís
Recipients Lluís, r.david.murray, serhiy.storchaka, vinay.sajip
Date 2012-05-21.11:26:09
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1337599570.65.0.962872333571.issue14868@psf.upfronthosting.co.za>
In-reply-to
Content
David, the problem is that if you have the logging inside a loop, the interpreter will have to evaluate the condition every time. With an assert you guarantee that *no code* is executed.

I know that we can find thousands of ways to do that, even writing a dynamic proxy for the Logger, and wrap the debug(), error() calls and return True, etc.

My is not telling developers to write "assert logger.debug('aa')" every time that they want to log something, but instead giving them the option to do that and be sure that *no code* is executed. Specially, because the return value of log functions is not used at all.

Thanks for the responses.
History
Date User Action Args
2012-05-21 11:26:10Lluíssetrecipients: + Lluís, vinay.sajip, r.david.murray, serhiy.storchaka
2012-05-21 11:26:10Lluíssetmessageid: <1337599570.65.0.962872333571.issue14868@psf.upfronthosting.co.za>
2012-05-21 11:26:10Lluíslinkissue14868 messages
2012-05-21 11:26:10Lluíscreate