[Python] What's the correct type hint for a type hint?

Discussão em 'Python' iniciado por Stack, Janeiro 10, 2025.

  1. Stack

    Stack Membro Participativo

    I have a use case for accepting type hints as arguments to a function. But what is the right type hint to to accept a type hint?

    T = TypeVar('T', bound='TypeHintType')

    def register_handler(type_hint: T, handler: Handler[T]) -> None:
    ...


    Is there a "TypeHintType" that I can use to annotate that a type hint is expected as an argument?

    Continue reading...

Compartilhe esta Página