3 ms·
Then the assert() triggers and you fix the assert() (or the bug). What's the issue here?
by spc476 3y ago
Then the assert() triggers and you fix the assert() (or the bug). What's the issue here?
- kr0bat 3y agoIn this example the assert is less explanatory than a comment. Why do if (condition): ... else: assert(!condition) ... When you could instead if (condition): ... else: #if (condition) ... Or otherwise explicitly comment the condition that was checked earlier. At least then if the comment is unchanged, whoever is touching your code will assume the comment is outdated, rather than assuming that you're asserting that x should be some undocumented magic number.