Inspectopedia
 
2024.3

Invalid usage of new-style type parameters and type aliases

Warning
New
Last modified: 03 December 2024

Reports invalid usage of PEP 695 type parameter syntax

Finds the following problems in function and class definitions and new-style type alias statements:

  • Extending typing.Generic in new-style generic classes

  • Extending parameterized typing.Protocol in new-style generic classes

  • Using generic upper bounds and constraints with type parameters for ParamSpec and TypeVarTuple

  • Mixing traditional and new-style type variables

  • Using traditional type variables in new-style type aliases

Examples: