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
mypy complains about this line of code. First I don't understand why and second I cannot bring it to accept it, even when including tzinfo=None in the parameter list.
Why does mypy think tzinfo would already be used, it cannot be from a List[int]. The behavior when running is as expected.
The helper function is annotated like this:
defsplit_int_string(digits: str, *at: int) ->List[int]:
""" Split a string at given indices and parse the parts to int. """# Make a canonical representation.split: List[int] =sorted(at)
ifnotsplitorsplit[0] !=0:
split.insert(0, 0)
ifsplit[-1] !=len(digits):
split.append(len(digits))
return [int(digits[split[i-1] : split[i]]) foriinrange(1, len(split))]
Bug Report
mypy complains about this line of code. First I don't understand why and second I cannot bring it to accept it, even when including
tzinfo=None
in the parameter list.Why does mypy think
tzinfo
would already be used, it cannot be from aList[int]
. The behavior when running is as expected.The helper function is annotated like this:
To Reproduce
(Write your steps here:)
python3
, it works.mypy
to see the error.Expected Behavior
I expect not to get a typing error for that line.
Actual Behavior
It prints
or
depending on whether one also adds the
tzinfo=None
or not.Your Environment
mypy.ini
(and other config files): noneThe text was updated successfully, but these errors were encountered: