flake8-simplify icon indicating copy to clipboard operation
flake8-simplify copied to clipboard

[Adjust Rule] SIM908: odd transform for self-assign

Open Skylion007 opened this issue 2 years ago • 0 comments

Desired change

  • Rule(s): SIM986, SIM987
  • Adjustment: In which way should it/they be adjusted?

Explanation

  • Invalid transformation for t

Example

This is an example where the mentioned rule(s) would currently be suboptimal:

        if "state_dict" in cpt:
            cpt = cpt["state_dict"]
        cpt = cpt.get("state_dict", cpt)

Is actually harder to read in this case.

Skylion007 avatar May 04 '22 18:05 Skylion007