Uh oh!
There was an error while loading. Please reload this page.
Delete many redundant method redefinitions - #6877
Conversation
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 |
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.
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.
I guess I just default to not making changes when we don't have a clear reason for change :)
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.