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
This looks like a duplicate of #230. Here are two workarounds:
You can use a local variable to hold the empty list and annotate the variable (empty: List[int] = []) and pass the variable as the second argument to sum.
You can cast the empty list to the desired type: sum(foo, cast(List[int], []))
When using sum() to concatenate lists, mypy fails to infer the type argument of "sum", even if types are declared explicitly.
sum([[1],[2],[3]], []
or
both give:
error: Cannot infer type argument 1 of "sum"
The text was updated successfully, but these errors were encountered: