Reputation: 18547
Does python provide functionality that only allow a piece of code to run during debug, a bit like preprocessor in c++?
Upvotes: 0
Views: 90
Reputation: 26329
I would suggest using the logger module (which is always great) and check for the log-level.
https://docs.python.org/2/library/logging.html
For example by using the getEffectiveLevel()
:
https://docs.python.org/2/library/logging.html#logging.Logger.getEffectiveLevel
This way you have some other nifty features like log messages with different levels…
Upvotes: 0