-
-
Notifications
You must be signed in to change notification settings - Fork 33.9k
gh-143728: Keep TypedDict and NamedTuple in class role in docs
#143702
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
base: main
Are you sure you want to change the base?
gh-143728: Keep TypedDict and NamedTuple in class role in docs
#143702
Conversation
Partially reverts pythonGH-143692; see python#143692 (comment)
| types. | ||
|
|
||
| .. function:: NamedTuple | ||
| .. class:: NamedTuple |
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.
does this one need to change? I don't think we have any attributes documented for NamedTuple with the .. attribute:: syntax
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.
| .. class:: NamedTuple | |
| .. function:: NamedTuple |
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.
What if this changes in the future, and we would then need to change the type again? My only concern is that changing the type results in warnings/errors for anyone referencing NamedTuple in their docs, so maybe we need to be careful when changing such types.
First example that came to mind was the peps repo, with some hits for TypedDict: https://github.com/search?q=repo%3Apython%2Fpeps+%2F%3Aclass%3A%60%28%28%7E%29%3Ftyping%5C.%29%3FTypedDict%2F&type=code
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 sure NamedTuple is likely to change, but I brought back the revert in 4244745.
It seems to me that status quo is a safer approach.
TypedDict and NamedTuple in class role in docsTypedDict in class role in docs
This reverts commit c323af9.
TypedDict in class role in docsTypedDict and NamedTuple in class role in docs
|
According to the discussion in #143692, I think we can change it from |
|
OK, I'll try to get I'll do that in the span of next 24 hours though. |
|
|
||
|
|
||
| .. function:: TypedDict | ||
| .. class:: TypedDict(dict) |
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 would fix #143728, see https://docs.python.org/3.15/library/typing.html#typing.__total__
TypedDict and NamedTuple in class role in docsTypedDict and NamedTuple in class role in docs
|
Should we merge this one then? |
Partially reverts GH-143692; see #143692 (comment)
📚 Documentation preview 📚: https://cpython-previews--143702.org.readthedocs.build/
TypedDict.__total__regressed in Python 3.13 docs #143728