The best Python feature you cannot use
Instead of having to limit sanity checks to the boundaries of the program, we could re-use those as function contracts using the
assertkeyword. Indeed, settingPYTHONOPTIMIZEremoves allassert, making the check useful in dev, and free in production.Unfortunately, the community doesn't know about the feature, and use
assertfor things that should never be removed, so using the flag would likely introduce bugs into your program.