Clarify generic type parameter ordering by BHUVANSH855 · Pull Request #2289 · python/typing
Also, is this already covered sufficiently in the conformance suite? What are the relevant tests that we have?
Addressed the requested changes:
- added a dedicated “Type parameter ordering” section header
- reordered the section so the Python 3.12 generic class syntax appears first
- updated “both examples” to “all of the examples above”
There is already conformance coverage for Protocol[...] ordering in conformance/tests/protocols_generic.py. In particular, the Proto1(Iterable[T_co], Protocol[S, T_co]) example together with the specialization checks verifies that type parameter ordering follows the Protocol[...] subscript order.
This PR expands the spec wording to make the broader ordering rules explicit, including Generic[...], parameterized Protocol[...], bare Protocol, and PEP 695 syntax.