I have been reading a bit about the assert statements in python and other languages. Particularly, I've read up on the assert in Python, Java and C. My understanding may not be a 100% correct, but the question that follows is about Python.
In the case of Python, why are assertions enabled by default? Why does python do this differently from other languages?** Is there a particular reason - compile time vs interpreted - for it?
- In Java, assertions are disabled by default unless explicitly enabled.
- In C and C++, programs using assertions from assert.hdon't have them disabled by default but most Makefiles do defineNDEBUGfor releases/distributions.- CMake sets NDEBUG by default for dist
- Many projects define their own assertMacro instead of usingassert.hand change the default behavior.
 
- CMake sets NDEBUG by default for 
I know my question is asking for a bit of historical context, but that is in fact the kind of answer that I am looking for.
Side note: I'm also new to python and where I work, we don't run any code in production with the optimization flags enabled. Is this a common practice when deploying python applications?
If you're interested, then below are the sources that I've read:
- What is the use of "assert" in Python?
- Why assertion is not enabled by default in java?
- Why is assert not enabled by default in java (duplicate)
- http://archive.is/5GfiG - Python mailing list archive on when to use assert.
 
     
    