Update docs/TRACEBACKS.md

Co-authored-by: Victor Goff <keeperotphones@gmail.com>
This commit is contained in:
Bob Hoeppner
2022-07-22 04:30:01 -05:00
parent 41ecb31749
commit 1ced3a3ac9

View File

@@ -187,7 +187,7 @@ AssertionError: divisor must be a number
``` ```
Once a bug is identified, consider replacing the `assert` with regular error handling. Once a bug is identified, consider replacing the `assert` with regular error handling.
This is because all `assert` statements can disabled through running Python with the `-O` or `-OO` options, or from setting the `PYTHONOPTIMIZE` environment variable to `1` or `2`. This is because all `assert` statements can be disabled through running Python with the `-O` or `-OO` options, or from setting the `PYTHONOPTIMIZE` environment variable to `1` or `2`.
Setting `PYTHONOPTIMIZE` to `1` is equivalent to running Python with the `-O` option, which disables assertions. Setting `PYTHONOPTIMIZE` to `1` is equivalent to running Python with the `-O` option, which disables assertions.
Setting `PYTHONOPTIMIZE` to `2` is equivalent to running Python with the `-OO` option, which both disables assertions and removes docstrings from the bytcode. Setting `PYTHONOPTIMIZE` to `2` is equivalent to running Python with the `-OO` option, which both disables assertions and removes docstrings from the bytcode.
Reducing bytecode is one way to make the code run faster. Reducing bytecode is one way to make the code run faster.