Skip to content

F841 preview changes to tuple unpacking #8884

@hauntsaninja

Description

@hauntsaninja

#8489 changes F841 so that it complains about unused variables resulting from tuple unpacking.

There are a few issues:

  • It's not clear to all folks that this can be disabled by prefixing the variable with an underscore (and unlike other cases, you can't just get rid of the variable / var name is often good documentation)
  • An autofix to automatically add the underscore prefix would help! Implemented in F841: support fixing unused assignments in tuples by renaming variables #9107
  • We actually currently mark F841 as unfixable, because it often keeps the RHS around (in case of side effect), and this is usually not the fix we want. So maybe both autofix and a custom error message?
  • Maybe best option is separate error code. A good parallel is how B007 is separate from F841. This also helps if you don't find the new lint useful, which I don't really

Metadata

Metadata

Assignees

No one assigned

    Labels

    acceptedReady for implementationhelp wantedContributions especially welcomeruleImplementing or modifying a lint rule

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions