-
-
Notifications
You must be signed in to change notification settings - Fork 239
Closed
Labels
✨ enhancementNew feature or improvementNew feature or improvement👋 good first issueGood for newcomersGood for newcomers
Description
Is your feature request related to a problem? Please describe.
mypy doesn't understand that Unset
is always falsy
if api_object.neighbours:
for x in api_object.neighbours: # <-- mypy: error: Item "Unset" of "Union[Unset, None, List[Neighbour]]" has no attribute "__iter__" (not iterable) [union-attr]
do_something_with(x)
Describe the solution you'd like
I would like mypy to understand this automatically
Type annotation on Unset.__bool__()
could be Literal[False]
instead of bool
, but typing.Literal is not available for python < 3.8.
Metadata
Metadata
Assignees
Labels
✨ enhancementNew feature or improvementNew feature or improvement👋 good first issueGood for newcomersGood for newcomers