Skip to content

Programming Style Suggestion #1

Description

@Zohair-coder

One pet peeve I have is that people often write code like this:

def isValid():
    myBool = False

    if myBool == True: # note this can also be simplified to simply myBool instead of myBool == True, but I'm often not sure what the best way to go about this is since the former tests for false-y values instead of boolean values
        return True
    else:
        return False

When this can be simplified to:

def isValid():
    myBool = False

    return myBool

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions