3

This question shows pylint reporting unnecessary-comprehension on this code:

dict1 = {"A": "This is A", "B": "This is B"}
bools = [True, False]

dict2 = {key: value for key, value in zip(dict1.keys(), bools)}

This question asks in general if there is an automated tool to fix pylint issues. It mentions black, autopep8, autoflake8. None of those fix this.

Is there a tool to apply that would fix this pylint warning?

dfrankow
  • 20,191
  • 41
  • 152
  • 214

1 Answers1

0

I think that there is not tool to fix that exact example automatically because you need to change the code and produce the same result, which is not easy to automate.

  • 2
    Autofixing all face the challenge you cite. What’s probably happening here is that the OP’s issue is not a frequently-occurring and easy fix. – JL Peyret May 31 '23 at 16:28