-
Notifications
You must be signed in to change notification settings - Fork 5
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
Type-checking columns
#259
Comments
Let's use |
You're not thinking big enough,
To fix this, we also have to use thing.py:7: error: Argument 1 to "a" has incompatible type "Dict[str, str]"; expected "Dict[str, Union[str, Iterable[str]]]" [arg-type]
thing.py:7: note: "Dict" is invariant -- see https://mypy.readthedocs.io/en/stable/common_issues.html#variance
thing.py:7: note: Consider using "Mapping" instead, which is covariant in the value type
Found 1 error in 1 file (checked 1 source file) As you said, typing support is not quite as mature in Python as it is in other languages… |
Updated columns type hint to |
Describe the bug
This:
does not type-check, with the error:
If you specify the columns directly in the call:
It type-checks no problem.
Expected behaviour
I expect this common idiom to be fine.
Additional context
I'm confused why this fails. Apparently,
Hashable
isn't properly supported by mypy? Something about mutability etc.Maybe we just (in the type hints) put our foot to the ground and say that metadata column names have to be str?
Or maybe there is another solution which I'm missing.
The text was updated successfully, but these errors were encountered: