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.
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.
| .. class:: NamedTuple | |
| .. function:: NamedTuple |
There was a problem hiding this comment.
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.
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.
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? |
|
Thanks @johnslavik for the PR, and @AlexWaygood for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14. |
… docs (pythonGH-143702) (cherry picked from commit 865eb12) Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
… docs (pythonGH-143702) (cherry picked from commit 865eb12) Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
|
GH-143799 is a backport of this pull request to the 3.14 branch. |
|
GH-143800 is a backport of this pull request to the 3.13 branch. |

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