You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Error: "foo" has type "Optional[int]" where both None and some other values (of type: "int") may behave as false in boolean contexts. Consider being explicit about the behaviour for None vs other falsy values. [optional-non-truthy]
@@ -398,6 +398,15 @@ values should indeed behave like `None`.
398
398
else:
399
399
...# executes when foo is None or 0
400
400
401
+
For instance, in the case that `None` and `0` should behave differently:
402
+
403
+
.. code-block:: python
404
+
405
+
if foo isnotNone:
406
+
...# executes when foo is any int, including 0
407
+
else:
408
+
...# executes when foo is None
409
+
401
410
.. _code-ignore-without-code:
402
411
403
412
Check that ``# type: ignore`` include an error code [ignore-without-code]
0 commit comments