From fb3bfce5130cd0d0c92817024937541934e67600 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Mon, 12 Apr 2021 14:36:18 -0700 Subject: [PATCH] docs: Add an additional truthiness antipattern to mypy best practices. Signed-off-by: Anders Kaseorg --- docs/testing/mypy.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/testing/mypy.md b/docs/testing/mypy.md index 4e28ebf119..cf52f8c574 100644 --- a/docs/testing/mypy.md +++ b/docs/testing/mypy.md @@ -376,9 +376,9 @@ collection. For example: * An exclude list where the default is to exclude nothing should be non-`Optional` with default `[]`. -Don't test an `Optional` value using truthiness (`if value:` or `if -not value:`), especially when the type might have falsy values other -than `None`. +Don't test an `Optional` value using truthiness (`if value:`, `not +value`, `value or default_value`), especially when the type might have +falsy values other than `None`. ```python s: Optional[str]