Conversation
hauntsaninja
left a comment
There was a problem hiding this comment.
Looks good, assuming you don't want any runtime recording of override
Thanks! The PEP specifies that there's no runtime effect, so that's what we're doing. |
|
@stroxler could you take a look? The docstring is probably the only interesting part. |
stroxler
left a comment
There was a problem hiding this comment.
Looks good to me, thanks @JelleZijlstra!
Co-authored-by: Steven Troxler <steven.troxler@gmail.com>
| _F = typing.TypeVar("_F", bound=typing.Callable[..., typing.Any]) | ||
|
|
||
| def override(__arg: _F) -> _F: |
There was a problem hiding this comment.
Just asking, my understanding was that types should not be added here and only provided via typeshed. I can't find a reference for it unfortunately. Did I miss something?
There was a problem hiding this comment.
It is true that type checkers will not look at this code. But types have value as documentation and perhaps some niche value for dynamic introspection.
AlexWaygood
left a comment
There was a problem hiding this comment.
Looks good! Some minor suggestions on docs/tests.
| This helps prevent bugs that may occur when a base class is changed | ||
| without an equivalent change to a child class. |
There was a problem hiding this comment.
| This helps prevent bugs that may occur when a base class is changed | |
| without an equivalent change to a child class. | |
| This helps prevent bugs that may occur when a method on a base class is renamed | |
| without an equivalent change to a child class. |
There was a problem hiding this comment.
I prefer the current more general wording. For example, the base class method could be removed instead of renamed.
There was a problem hiding this comment.
Oh, good point. Ignore this then :)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
No description provided.