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
I just started trying to apply typing to a code base, so I may be greatly miss-understanding what I am doing, but here we go :)
We have a case where we get a tuple back from a user supplied function which must be (None, None), (some_not_none, None), or (some_not_none, other_not_none), that the second value can only be not None if the first value is also not None. (This is why I did not do Tuple[Optional[int], Optional[int]]).
Activity
ilevkivskyi commentedon Feb 13, 2017
@tacaswell Oh, this is a well known bug in mypy, see e.g. python/mypy#1855 and python/mypy#1575. There is even a PR for this python/mypy#2219 but I don't know when it will land.
Probably you could use your workaround with less precise type, or maybe use an overload in stub file, something like
might work (overloads will be allowed also outside stubs, i.e. in source code, see python/mypy#2603, but it is also not clear when this lands).
tacaswell commentedon Feb 13, 2017
Thanks! Sorry for the noise!
ilevkivskyi commentedon Feb 13, 2017
No problem at all :-)