Skip to content
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

dict cannot receive a list #5819

Closed
kasium opened this issue Jul 29, 2021 · 2 comments
Closed

dict cannot receive a list #5819

kasium opened this issue Jul 29, 2021 · 2 comments

Comments

@kasium
Copy link
Contributor

kasium commented Jul 29, 2021

Hey,

the below works fine, but it seems like the stubs are incomplete:

dict([x.split(",", maxsplit=1) for x in ["1,2", "2,3"]])

mypy:

x.py:1: error: Argument 1 to "dict" has incompatible type "List[List[str]]"; expected "Iterable[Tuple[<nothing>, <nothing>]]"

This code obviously only works if each sublist has only two entries.

@JelleZijlstra
Copy link
Member

This is a duplicate of #2862, which points to python/typing#592. There's not much we can do about it in typeshed for now.

@kasium
Copy link
Contributor Author

kasium commented Jul 29, 2021

Thanks, can be closed

@kasium kasium closed this as completed Jul 29, 2021
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

2 participants