[Python] Type hints when unpacking a tuple

Discussão em 'Python' iniciado por Stack, Maio 25, 2025.

  1. Stack

    Stack Membro Participativo

    Is it possible to use type hinting when unpacking a tuple? I want to do this, but it results in a SyntaxError:

    from typing import Tuple

    t: Tuple[int, int] = (1, 2)
    a: int, b: int = t
    # ^ SyntaxError: invalid syntax

    Continue reading...

Compartilhe esta Página