Skip to content

Files

Latest commit

 

History

History
29 lines (22 loc) · 522 Bytes

unneeded-not.md

File metadata and controls

29 lines (22 loc) · 522 Bytes

Pattern: Use of verbose boolean negation

Issue: -

Description

You can simplify certain boolean expressions containing negation to not use it. This change will make the code more succinct and clear to the readers.

Example of incorrect code:

def do_stuff():
    someint = 5
    if not someint > 3:
        return False
    else:
        return True

Example of correct code:

def do_stuff():
    someint = 5
    if someint <= 3:
        return False
    else:
        return True