With optimizations enabled, it will completely disappear, meaning for consistent behavior you need to reproduce its functionality. Additionally, users will appreciate being able to catch a more meaningful error than AssertionError in their dependent code.
https://docs.python.org/3/reference/simple_stmts.html#the-assert-statement
The current code generator emits no code for an assert statement when optimization is requested at compile time.
https://stackoverflow.com/a/1838411/1588795
With optimizations enabled, it will completely disappear, meaning for consistent behavior you need to reproduce its functionality. Additionally, users will appreciate being able to catch a more meaningful error than
AssertionErrorin their dependent code.https://docs.python.org/3/reference/simple_stmts.html#the-assert-statement
https://stackoverflow.com/a/1838411/1588795