mirror of https://github.com/zulip/zulip.git
docs: Add an additional truthiness antipattern to mypy best practices.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
c4b60acf9c
commit
fb3bfce513
|
@ -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]
|
||||
|
|
Loading…
Reference in New Issue