Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Do not raise exceptions. The only exception are assertions, and only for quieting the linter (e.g. assert value is not None on Pylance). An assertion used in this way must be impossible to hitfail.

Info

What’s wrong with exceptions?

Exceptions are computationally expensive to catch, which is why the Autonomy coding style often uses result booleans and/or default values instead. While the program will not crash if your code raises an exception, it will cause an early (graceful) exit.

...