Skip to content

Best way to indicate debugging code in python? #7648

Answered by tausbn
robinwatts asked this question in Q&A
Discussion options

You must be logged in to vote

This is an interesting question (and you've definitely asked it in the right venue!). I don't know of any particular "best practice" when it comes to this issue, but I do have a few thoughts.

First of all, you're right in thinking that doing debug = 0 followed by if debug: ... probably won't do the trick. In this case, I'm fairly certain that our analysis will be able to see through the deceit and figure out that debug is actually always false. However, more complicated expressions should be able to fool our analysis. For example, something like if 0*0: ... is enough to fool our analysis into not pruning the body of the if-statement (which makes the statements therein unreachable).

For a …

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by robinwatts
Comment options

You must be logged in to vote
1 reply
@tausbn
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants