But if asserts get turned off in a release build, it's suddenly vulnerable to buffer overflow attacks.
Python assert checking is removed when the code is run with python -O ("optimize"), so it shouldn't be used to validate user input, checking for critical conditions, etc. It is just a defensive programming and debugging tool.