Skip to content

if 'var == True:' being replaced with 'if var:' #539

@Flamefire

Description

@Flamefire

New issue after #86

To make it short: Even though it is done only in aggressive mode 2 it is wrong.

if var == True has the semantic of if var is True. E.g. [1] == True evaluates to False. So this "fix" changes semantic.

I deeply believe this should not be done. Even though it might be unintentional there are cases where an == True or better is True are wanted. Changing the semantic isn't something an autoformatter/autofixer should do.

Rationale: Core description is "autopep8 automatically formats Python code to conform to the PEP 8 style guide.". It is NOT up to the tool to "fix" possible coding errors only to make sure it is PEP8 correct

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions