DEV Community

Discussion on: Writing Idiomatic Python Code

Collapse
 
rouilj profile image
John P. Rouillard

Are asserts still removed when python runs with -O? If so what does that mean for code accuracy by using asserts?

Collapse
 
bascodes profile image
Bas Steins

asserts would be removed. Apart from tools like py2exe I have barely seen -O in the wild.
But, yes, the asserts would render useless – so it's important to have a good test coverage.