-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Remove ParamSpec for SupportsReplace #12410
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
Remove ParamSpec for SupportsReplace #12410
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
class _SupportsReplace(Protocol): | ||
# In reality doesn't support args, but there's no other great way to express this. | ||
def __replace__(self, *args: _P.args, **kwargs: _P.kwargs) -> Self: ... | ||
def __replace__(self, *args: Any, **kwargs: Any) -> Self: ... |
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.
(Can't add this as suggestion.)
class _SupportsReplace(Protocol):
def __replace__(self, **changes: Any) -> Self: ... # changes as passed to replace()
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.
If you look back at the old PR, this doesn't work, since type-checkers will complain if the implementation does have **kwargs
, as opposed to supporting any amount of variable key word arguments.
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.
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.
@srittau Just wanted to follow up on this.
This comment has been minimized.
This comment has been minimized.
@srittau Just wanted to follow-up again on this one. |
This comment has been minimized.
This comment has been minimized.
@srittau Sorry to double ping here, but was curious if you had any thoughts! |
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
Address Eric's comment here: #12262 (comment)
Accidentally undid this commit before merging.