Skip to content

Files

Latest commit

 

History

History
21 lines (14 loc) · 343 Bytes

unnecessary-negation.md

File metadata and controls

21 lines (14 loc) · 343 Bytes

Pattern: Unnecessary negation

Issue: -

Description

Used when a boolean expression contains an unneeded negation, e.g. when two negation operators cancel each other out.

Example of incorrect code:

if not not input():  # [unnecessary-negation]
    pass

Example of correct code:

if input():
    pass