Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 2k
Delete many redundant method redefinitions#6877
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
AlexWaygood commented Jan 9, 2022 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
This comment has been minimized.
This comment has been minimized.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
AlexWaygood commented Jan 9, 2022
I assume |
This comment has been minimized.
This comment has been minimized.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
JelleZijlstra commented Jan 9, 2022
More likely it distinguishes between classes that override |
JelleZijlstra commented Jan 9, 2022
So as a corollary, we should not remove any other |
AlexWaygood commented Jan 9, 2022 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
Sure, that makes sense for |
This comment has been minimized.
This comment has been minimized.
JelleZijlstra commented Jan 9, 2022
I don't have time to look into the details right now (got a lot of things to catch up with), but I believe mypy's logic for unsafe |
AlexWaygood commented Jan 9, 2022
I'm reverting it as we speak, dw! Was just curious, it's obvs not your job to figure it out for me :) |
Uh oh!
There was an error while loading. Please reload this page.
| exc: BaseException | ||
| tb: TracebackType | ||
| def __init__(self, exc: BaseException, tb: TracebackType) -> None: ... | ||
| def __reduce__(self) -> str | tuple[Any, ...]: ... |
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.
Not 100% sure about this since I could imagine a type checker checking whether an object can be pickled safely and checking __reduce__ overrides.
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.
You've changed your tune ;)
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.
I guess I just default to not making changes when we don't have a clear reason for change :)
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.
A sound policy.
This comment has been minimized.
This comment has been minimized.
2 similar comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Uh oh!
There was an error while loading. Please reload this page.
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
AlexWaygood commented Jan 9, 2022
Thanks! |
All classes implicitly inherit from
objectin Python 3, so it's almost never necessary to explicitly define__str__or__repr__in the stubs (there are a few exceptions, if it's e.g. marked as an abstract method in a base class).I haven't touched any of the files in the
stubsdirectory in this PR, as some of those need compatibility with Python 2; this PR only touches the standard-library stubs.