[Python] What do ** (double star/asterisk) and * (star/asterisk) inside square brakets mean...

Discussão em 'Python' iniciado por Stack, Fevereiro 3, 2025.

  1. Stack

    Stack Membro Participativo

    What does T, *Ts, **P mean when they are used in square brackets directly after a class or function name or with the type keyword?

    class ChildClass[T, *Ts, **P]: ...

    def foo[T, *Ts, **P](arg: T) -> Callable[P, tuple[T, *Ts]]:

    type vat[T, *Ts, **P] = Callable[P, tuple[T, *Ts]]


    See complementary questions about ** and * for function parameters and arguments:


    Continue reading...

Compartilhe esta Página