We're all consenting adults, so I won't judge you for doing so. But if you have reason for doing so, I will also assume that you know the caveats, just like you will have to, if you redefine print().
How will the compiler step know I redefined assert? Right now assert has 0 runtime impact with -O because the statement is not even present in the bytecode, if assert becomes a function python will always need to do a lookup.
9
u/Anonymous_user_2022 Jan 21 '22
It has to be. It's opening a stinky can of worms to treat the 2-tuple Truthy other than all of the other kind of Truthies there are.
There's nothing wrong with letting the hypothetical assert() function being a nop, when -O is present.