Skip to content

Bug: No overload variant of "list" matches argument type "object" #9068

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

Closed
MartinThoma opened this issue Jun 29, 2020 · 3 comments
Closed

Bug: No overload variant of "list" matches argument type "object" #9068

MartinThoma opened this issue Jun 29, 2020 · 3 comments

Comments

@MartinThoma
Copy link

MartinThoma commented Jun 29, 2020

MVCE

from typing import List, Tuple


def second(n: Tuple[int, str]) -> str:
    return n[1]


def get_sort_order(ids: List[str]) -> List[int]:
    sort_order_t = list(zip(*sorted(enumerate(ids), key=second)))[0]
    sort_order = list(sort_order_t)
    return sort_order


if __name__ == "__main__":
    ids = ["a", "b", "x", "c"]
    print(get_sort_order(ids))
    # [0, 1, 3, 2]

using mypy 0.782 I get:

$ python3.8 -m mypy example.py                                                                                                                                                                                <aws:joyn-dev>
example.py:10: error: No overload variant of "list" matches argument type "object"
example.py:10: note: Possible overload variant:
example.py:10: note:     def [_T] list(self, iterable: Iterable[_T]) -> List[_T]
example.py:10: note:     <1 more non-matching overload not shown>
Found 1 error in 1 file (checked 1 source file)

I expected this to run without an error.

@kaste
Copy link

kaste commented Jul 1, 2020

That's basically #6968 in combination with an already reverted typeshed zip change. This actually does not produce errors on 0.770 where it introduces Anys here

@JukkaL
Copy link
Collaborator

JukkaL commented Jul 3, 2020

GitHub master already includes the typeshed change, and the code generates no errors. Is there something else to do here?

@AlexWaygood
Copy link
Member

GitHub master already includes the typeshed change, and the code generates no errors. Is there something else to do here?

Doesn't look like it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants