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
Potential bug. One of my colleagues noticed that a collection of type Collection[Optional[float]] will act as if it is Collection[Optional[float]] even after any possible None is removed.
Minimal Example:
def mypy_subtract(nulled: bool) -> float:
if nulled:
returnable = [None, None]
else:
returnable = [1.0, 2.0]
if None in returnable:
raise Exception
return returnable[0] - returnable[1]
What is the actual behavior/output?
itemscoringmigration/mypy_example.py:5: error: List item 0 has incompatible type "float"; expected "None"
itemscoringmigration/mypy_example.py:5: error: List item 1 has incompatible type "float"; expected "None"
itemscoringmigration/mypy_example.py:10: error: Unsupported left operand type for - ("None")
What is the behavior/output you expect?
No errors.
What are the versions of mypy and Python you are using?
mypy 0.761
Python 3.6.8
Do you see the same issue after installing mypy from Git master?
Yes.
No flags used.
Thanks for all the hard work. I love this package.
The text was updated successfully, but these errors were encountered:
Closing as duplicate of #2980. This is a relatively low-priority feature since this comes up pretty rarely and the implementation would be non-trivial (and there are some potential type safety issues).
Potential bug. One of my colleagues noticed that a collection of type
Collection[Optional[float]]
will act as if it isCollection[Optional[float]]
even after any possibleNone
is removed.Minimal Example:
What is the actual behavior/output?
What is the behavior/output you expect?
No errors.
What are the versions of mypy and Python you are using?
mypy 0.761
Python 3.6.8
Do you see the same issue after installing mypy from Git master?
Yes.
No flags used.
Thanks for all the hard work. I love this package.
The text was updated successfully, but these errors were encountered: