-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Improve annotation for tabular_data
parameter of tabulate.tabulate
#13178
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
Conversation
This comment has been minimized.
This comment has been minimized.
tabular_data
parameter of tabulate.tabulate
The significant line is here: https://github.com/astanin/python-tabulate/blob/537d7b03932263062d37a7e747f19a385709b9f7/tabulate/__init__.py#L1502 So technically any value is supported as key, so |
Why would you use What expectation/comment did you have in mind? |
Since Mapping is invariant in the key type, using |
I wasn't aware of the invariance... Thanks for your patience @srittau and @JelleZijlstra. I'm not sure about a potential comment wrt. the expectations on the key type. Since str can be called on any object there aren't any I'm aware of. |
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Sebastian Rittau <[email protected]>
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
The type of keys does not matter when a dict of columns is passed to tabulate.
In particular, I have a case where I pass a dict with int keys, and it works fine, but is flagged by mypy.