Uh oh!
There was an error while loading. Please reload this page.
Update generics reference to use PEP 695 type parameter syntax - #2242
Update generics reference to use PEP 695 type parameter syntax#2242BHUVANSH855 wants to merge 5 commits into
Conversation
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
srittau
commented
Apr 8, 2026
Thanks so far, but I also think the whole "Defining subclasses of generic classes" needs to be rewritten, as with Python 3.12 syntax, |
@srittau I made a few final refinements:
Everything should now consistently reflect the Python 3.12+ style. Kindly review it again. |
BHUVANSH855
commented
Apr 12, 2026
Just checking in regarding the latest updates to this PR. Thank you! |
Uh oh!
There was an error while loading. Please reload this page.
BHUVANSH855
commented
Apr 22, 2026
Just checking in regarding the latest updates to this PR. Thank you! |
JelleZijlstra
left a comment
There was a problem hiding this comment.
There are lots of remaining places in the document using the old syntax. Look for all places that still use T = TypeVar("T")-style syntax and replace them.
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.
Uh oh!
There was an error while loading. Please reload this page.
BHUVANSH855
commented
Apr 22, 2026
Thanks for the review! @JelleZijlstra I’ve now updated the generics reference to consistently use the PEP 695 type parameter syntax in all applicable examples, including generic functions, methods, class methods, and bounded type parameters. I kept Please let me know if anything else should be refined. |
BHUVANSH855
commented
Apr 24, 2026
Hi @JelleZijlstra, Just checking in regarding the latest updates to this PR. Thank you! |
JelleZijlstra
commented
Apr 25, 2026
The document still has many old-style ParamSpec and TypeVar declarations further down. It also says "By default, all user-defined generics are invariant." which is no longer correct. |
BHUVANSH855
commented
Apr 29, 2026
Thanks for the review @JelleZijlstra, I’ve updated the invariance statement and added the missing imports in the variance examples. I also ensured formatting consistency in the code blocks. Please let me know if anything else needs adjustment. |
JelleZijlstra
commented
May 1, 2026
Please stop pinging on this PR. I'm a bit tired of it because of the number of times I've had to ask you to complete the change. I'll look at it when I find the time and energy; in the meantime please do not send any more pings. |
cc96f6e to
9731d54Compare
This PR updates the
reference/generics.rstdocumentation to reflect the modern type parameter syntax introduced in PEP 695.Changes include:
Stack,Box) to useclass Foo[T]syntaxTypeVar/Genericto PEP 695This improves consistency with the spec documentation and reduces confusion for users of Python 3.12+.
Fixes#2227