Skip to content

SIM109: Multiple comparisons of same variable #11

@MartinThoma

Description

@MartinThoma

Explanation

Use the "in" operator and a list / tuple instead of multiple comparisons.

Example

# Bad
if a == b or a == c:
    d

# Good
if a in [b, c]:
    d

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions