-
Notifications
You must be signed in to change notification settings - Fork 23
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
Encourage typing_extensions.Unpack for many overload-invariant keywords #285
Comments
We shouldn't do this in typeshed until PEP 692 is accepted. I think it's better to also wait in flake8-pyi. |
Yeah, I agree. Hopefully the PEP will be accepted, but until then this is essentially an unofficial/unsanctioned use of this symbol, so I'm not sure we should write a lint enforcing its use just yet. I'll mark this as "deferred" for now :) |
The PEP's been accepted now, but mypy's support is still guarded behind |
If a function has many keyword arguments that do not change across all overloads (for example pandas.read_csv). It is more readable and shorter to move all the overload-invariant keywords into a TypedDict and suggest using the
Unpack
feature which is supported by at least pyright and mypy.This would probably need some heuristic of when is it worth recommending Unpack: Using a TypedDict for less than
insert magic number
keywords is probably not helpful.The text was updated successfully, but these errors were encountered: