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
The revealed type in the following program is int though it should be Optional[int] when using --strict-optional:
d = {'x': 1}
a = d.get('y')
reveal_type(a)
This also needs a typeshed change, but I think that there was a mypy issue with overloaded functions that is related. It's worth having a separate issue to track this here.
The text was updated successfully, but these errors were encountered:
gvanrossum
changed the title
Return type of dict get wrong then using strict optional checking
Return type of dict.get is wrong when using strict optional checking
Jun 23, 2016
(Also, if you pass an explicit default of a different type, it becomes a union of int and that type, regardless of the --strict-optional setting. IIRC that was a problem in the past too.)
The revealed type in the following program is
int
though it should beOptional[int]
when using--strict-optional
:This also needs a typeshed change, but I think that there was a mypy issue with overloaded functions that is related. It's worth having a separate issue to track this here.
The text was updated successfully, but these errors were encountered: