-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
false-positivemypy gave an error on correct codemypy gave an error on correct codeneeds discussionpriority-1-normaltopic-union-types
Description
The type of the following conditional expression is object:
s: str = "key=value"
a, b = s.split("=", 1) if "=" in s else ("key", "default")
# main.py:2: error: 'builtins.object' object is not iterable
It should be a union type instead, such as Union[List[str], Tuple[str, str]].
(Note that str.split returns List[str] while the else branch has the type Tuple[str, str].)
This is a follow-up to #3487.
Metadata
Metadata
Assignees
Labels
false-positivemypy gave an error on correct codemypy gave an error on correct codeneeds discussionpriority-1-normaltopic-union-types