Clarify generic type parameter ordering by BHUVANSH855 · Pull Request #2289 · python/typing · GitHub
Skip to content

Clarify generic type parameter ordering - #2289

Open
BHUVANSH855 wants to merge 4 commits into
python:mainfrom
BHUVANSH855:spec/type-parameter-order
Open

BHUVANSH855 wants to merge 4 commits into
python:mainfrom
BHUVANSH855:spec/type-parameter-order

Conversation

@BHUVANSH855

Copy link
Copy Markdown
Contributor

Summary

Clarify how type parameter ordering is determined for generic classes.

This expands the existing wording in the generics spec to explicitly
cover:

  • Generic[...] base classes
  • parameterized Protocol[...] base classes
  • Python 3.12 generic class syntax

The updated wording also clarifies that a bare Protocol base class
does not affect type parameter ordering.

Closes #2059

@srittau srittau added the topic: typing spec For improving the typing spec label May 18, 2026
@JelleZijlstra

Copy link
Copy Markdown
Member

@JelleZijlstra JelleZijlstra left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should add a section header "Type parameter ordering", starting at line 487 or so. Currently this is in a section "Arbitrary generic types as base classes", which isn't really apposite.

Comment thread docs/spec/generics.rst Outdated
Comment thread docs/spec/generics.rst Outdated
@JelleZijlstra

Copy link
Copy Markdown
Member

Also, is this already covered sufficiently in the conformance suite? What are the relevant tests that we have?

@BHUVANSH855

Copy link
Copy Markdown
Contributor Author

@BHUVANSH855
BHUVANSH855 requested a review from JelleZijlstra May 21, 2026 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic: typing spec For improving the typing spec

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Spec: More precision on type parameter order

3 participants