-
-
Notifications
You must be signed in to change notification settings - Fork 31.1k
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
gh-91491: What's New in 3.11 section for typing PEPs #91721
Conversation
Other aspects of typing aren't covered yet; I'll do that in a separate PR.
cc PEP authors @davidfstr @mrahtz @pradeep90 @Gobot1234 |
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.
This LGTM but I'm not an expert authority on the PEPs listed. So I'm waiting for them to give their reviews.
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.
The Self section looks good, thanks Jelle.
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 few nits, but on the whole this looks great!
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.
Added some wordsmithing comments. Thanks for drafting @JelleZijlstra !
Thanks everyone for the feedback! I pushed a commit addressing most requests and adding some links. |
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.
Awesome, thank you!
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.
LGTM
def __enter__(self) -> Self: | ||
self.lock() | ||
return 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.
One important use case is that calling this method on a subclass object will return the subclass type, not this class type. e.g.,
class ChildLock(MyLock): ...
ChildLock().__enter__() # type is `ChildLock`, not `MyLock`.
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.
Do you think that should be mentioned here? It's meant to be a brief summary after all.
LGTM. Thanks, Jelle! |
Co-authored-by: Pradeep Kumar <gohanpra@gmail.com>
Other aspects of typing aren't covered yet; I'll do that in a
separate PR.
#91491