update design guide

This commit is contained in:
caternuson 2021-02-11 14:28:58 -08:00
parent aae10fb37f
commit ac6695faba

View File

@ -165,6 +165,24 @@ use what.
Here is more info on properties from Here is more info on properties from
`Python <https://docs.python.org/3/library/functions.html#property>`_. `Python <https://docs.python.org/3/library/functions.html#property>`_.
Exceptions and asserts
--------------------------------------------------------------------------------
Raise an appropriate `Exception <https://docs.python.org/3/library/exceptions.html#bltin-exceptions>`_,
along with a useful message, whenever a critical test or other condition fails.
Example::
if not 0 <= pin <= 7:
raise ValueError("Pin number must be 0-7.")
If memory is constrained and a more compact method is needed, use `assert`
instead.
Example::
assert 0 <= pin <= 7, "Pin number must be 0-7."
Design for compatibility with CPython Design for compatibility with CPython
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------