-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Tuple[...] should be compatible with Iterable[...] and Sequence[...] #296
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
Comments
Implementation waiting to be merged in the type-system-features branch: afe4c57 |
This problem still exists in 2018... mypy==.580 async def execute_update(query: str, query_args: Sequence[Any]=None)->None: await DbExecutor.execute_update("select 1", (5)) error: Argument 2 to "execute_update" has incompatible type "int"; expected "Optional[Sequence[Any]]" Resolution is to use [5] instead of (5) ... which is not what I want Why is this closed? |
@terrisgit -- If you instead pass in |
Gotta give points for the attitude. |
Thanks for the education! |
I have a next case: the result of one function is |
@user-name-name Mypy is correct, |
This operates by generating a "shadow vtable" containing pointers to glue methods that dispatch to the appropriate method via the C API. We then install those shadow vtables in interpreted subclasses so that overridden methods will be called. This does not support directly inheriting from traits, which I think will require generating vtables dynamically (and maybe some more nonsense too.) Closes #296. (Though I will file a follow-up for traits.)
This operates by generating a "shadow vtable" containing pointers to glue methods that dispatch to the appropriate method via the C API. We then install those shadow vtables in interpreted subclasses so that overridden methods will be called. This does not support directly inheriting from traits, which I think will require generating vtables dynamically (and maybe some more nonsense too.) Closes #296. (Though I will file a follow-up for traits.)
This operates by generating a "shadow vtable" containing pointers to glue methods that dispatch to the appropriate method via the C API. We then install those shadow vtables in interpreted subclasses so that overridden methods will be called. This does not support directly inheriting from traits, which I think will require generating vtables dynamically (and maybe some more nonsense too.) Closes #296.
Currently, Tuple[int, int] is not compatible with Iterable[int] and Sequence[int], but it should obviously be. Also, update type join to support this (join of Tuple[int, int] and Tuple[int] should be Sequence[int]).
For example, this program is rejected:
See also #184 (it's very closely related).
The text was updated successfully, but these errors were encountered: