starmap-zip (RUF058)
Added in 0.12.0 · Related issues · View source
Fix is sometimes available.
What it does
Checks for itertools.starmap calls where the second argument is a zip call.
Why is this bad?
zip-ping iterables only to unpack them later from within starmap is unnecessary.
For such cases, map() should be used instead.
Example
Use instead:
Fix safety
This rule's fix is marked as unsafe if the starmap or zip expressions contain comments that
would be deleted by applying the fix. Otherwise, the fix can be applied safely.
Fix availability
This rule will emit a diagnostic but not suggest a fix if map has been shadowed from its
builtin binding.