diff options
author | Damien George <damien.p.george@gmail.com> | 2018-03-05 19:10:45 +1100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2018-03-05 19:10:45 +1100 |
commit | a5fb699d87ffa178736021c4763d323be54e87d4 (patch) | |
tree | dfd5dbfc093144cfab1fe1ddbc333c2d45b65fc1 | |
parent | 6e09320b4c5b3b6630acb70ee5c28154a757e61a (diff) |
docs/library/micropython: Describe optimisation levels for opt_level().
-rw-r--r-- | docs/library/micropython.rst | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/docs/library/micropython.rst b/docs/library/micropython.rst index d1f923e31..a6ea738ed 100644 --- a/docs/library/micropython.rst +++ b/docs/library/micropython.rst @@ -33,6 +33,18 @@ Functions compilation of scripts, and returns ``None``. Otherwise it returns the current optimisation level. + The optimisation level controls the following compilation features: + + - Assertions: at level 0 assertion statements are enabled and compiled into the + bytecode; at levels 1 and higher assertions are not compiled. + - Built-in ``__debug__`` variable: at level 0 this variable expands to ``True``; + at levels 1 and higher it expands to ``False``. + - Source-code line numbers: at levels 0, 1 and 2 source-code line number are + stored along with the bytecode so that exceptions can report the line number + they occurred at; at levels 3 and higher line numbers are not stored. + + The default optimisation level is usually level 0. + .. function:: alloc_emergency_exception_buf(size) Allocate *size* bytes of RAM for the emergency exception buffer (a good |