unpack syntax¶
basedpython polyfills the PEP 646 starred-type syntax for python versions below 3.11:
transpiles to:
the starred form (*T) is native in python 3.11+. for earlier targets the equivalent Unpack[T] form is used instead. the import resolves to typing_extensions because typing.Unpack only exists from 3.11 — the version at which this transform stops firing
when it applies¶
the transform rewrites starred types in variadic parameter annotations and inside subscript slices:
starred expressions in value positions (unpacking in assignments, function calls, etc.) are never affected
--min-version interaction¶
when targeting Python 3.11 or later, the starred form is valid natively and the transform is a no-op