Skip to content

Encourage Using if not ... Instead of if ... is None when Applicable #499

Description

@ATATC

For example:

def plugin(self, key: str, plugin: Plugin | None = None) -> Plugin | None:
    if plugin is None:
        return self._plugins[key]
    self._plugins[key] = plugin
    plugin.on_load(self)

plugin is never treated as False when meaningful. It should be simply if not plugin.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

code reviewCode review or commentenhancementNew feature or requesttodoNew task or assignment

Type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions