We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The following code:
from typing import Sequence def f(b: bool) -> Sequence[int]: return (5,) if b else ()
produces the following output:
$ python3 Test.py $ mypy Test.py Test.py:4: error: Incompatible return value type (got "object", expected "Sequence[int]") Found 1 error in 1 file (checked 1 source file) $ mypy --version mypy 0.740 $ python3 --version Python 3.6.8
This looks like a false positive to me.
It seems that () should be compatible with any non-empty Tuple[...] or Sequence[...]. The same goes to [].
()
Tuple[...]
Sequence[...]
[]
The text was updated successfully, but these errors were encountered:
Duplicate of #4975
Sorry, something went wrong.
No branches or pull requests
The following code:
produces the following output:
This looks like a false positive to me.
It seems that
()
should be compatible with any non-emptyTuple[...]
orSequence[...]
. The same goes to[]
.The text was updated successfully, but these errors were encountered: