Skip to content

Format type parameters on functions and classes #5931

@konstin

Description

@konstin

PEP 695 introduces type parameters on function and classes in python 3.12, which are currently not considered when formatting, but should be added:

class ClassA[T: str]:
    def method1(self) -> T:
        ...

def func[T](a: T, b: T) -> T:
    ...

Their implementation can likely reuse larger parts of dict comprehensions. See psf/black#3703 for the black implementation

Metadata

Metadata

Assignees

Labels

formatterRelated to the formatterpython312Related to Python 3.12

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions