ID EN
Typing

Unpack

Python 3.11 🇮🇩 Bahasa Indonesia

Mengetik operator untuk secara konseptual menandai suatu objek sebagai telah dibongkar.

Syntax

PYTHON
typing.Unpack

Contoh

Example 1
PYTHON
Ts = TypeVarTuple('Ts')
tup: tuple[*Ts]
 Effectively does:
tup: tuple[Unpack[Ts]]
Example 2
PYTHON
In older versions of Python, TypeVarTuple and Unpack
 are located in the `typing_extensions` backports package.
from typing_extensions import TypeVarTuple, Unpack

Ts = TypeVarTuple('Ts')
tup: tuple[*Ts]          Syntax error on Python <= 3.10!
tup: tuple[Unpack[Ts]]   Semantically equivalent, and backwards-compatible

See Also

type variable tuple typing.TypeVarTuple builtins.tuple