non-pep646-unpack (UP044)
Derived from the pyupgrade linter.
Fix is always available.
This rule is unstable and in preview. The --preview
flag is required for use.
What it does
Checks for uses of Unpack[]
on Python 3.11 and above, and suggests
using *
instead.
Why is this bad?
PEP 646 introduced a new syntax for unpacking sequences based on the *
operator. This syntax is more concise and readable than the previous
Unpack[]
syntax.
Example
Use instead:
Fix safety
This rule's fix is marked as unsafe, as Unpack[T]
and *T
are considered
different values when introspecting types at runtime. However, in most cases,
the fix should be safe to apply.