Skip to content

Type hinting a class decorator that returns a subclass #1528

@BojieSheng

Description

@BojieSheng

Anyone knows who to annotate "cls" and return type for below function "examle_a"?

def example_a(cls):
    class A(cls):
        def __init__(self, x, y):
            self.x=x
            self.y=y
            super().__init__(x,y)

    return A

cls can be any class.

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: otherOther topics not covered

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions