diff --git a/pep-0008.txt b/pep-0008.txt index 4a0541ecd..afe7f2c20 100644 --- a/pep-0008.txt +++ b/pep-0008.txt @@ -919,6 +919,18 @@ Programming Recommendations have a type (such as a container) that could be false in a boolean context! +- Use ``is not`` operator rather than ``not ... is``. While both + expressions are functionally identical, the former is more readable + and preferred. + + Yes:: + + if foo is not None: + + No:: + + if not foo is None: + - When implementing ordering operations with rich comparisons, it is best to implement all six operations (``__eq__``, ``__ne__``, ``__lt__``, ``__le__``, ``__gt__``, ``__ge__``) rather than relying