Skip to content

useless-return (PLR1711)#

Derived from the Pylint linter.

Fix is always available.

What it does#

Checks for functions that end with an unnecessary return or return None, and contain no other return statements.

Why is this bad?#

Python implicitly assumes a None return at the end of a function, making it unnecessary to explicitly write return None.


def f():
    return None

Use instead:

def f():