-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
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
Can't convert from Tuple of optional to Tuple of non-optional #8622
Comments
Did you mean to use |
Ohhh. Sorry for wrong example. Yes, I mean |
It works to write |
Why? Without this given error look strange. And tuple can have more than 2 element, in this case line with "crutch" will be too long. Also I have example with cast list of optional to list of non-optional and double check on None.
Errors:
|
@kventinel The reason why we are unlikely to support this is that the implementation looks non-trivial and this use case seems quite rare, relative some other use cases that we also don't support well. So at least the fix would be low priority. About your other examples: you can create separate issues about these; we'll consider each case where type inference goes wrong separately. |
But what so non-trivial in the implementation? I think, it's not so difficult propagate new type to element of fixed size tuple as it's work with single value. And I think, that my other examples even more non-trivial than first:) And I think, this issue must be reopened as bug (even if it would be low priority). |
Fair enough. If somebody comes up with a simple enough implementation, we will consider merging a PR. |
Code:
After that has error:
Expected no error.
I have:
mypy-0.770
andPython 3.7.7
The text was updated successfully, but these errors were encountered: