pylint-errors

W0621 (redefined-outer-name)

:x: Problematic code:

var = 0


def foo(x, y):
    var = x + y
    return var

:heavy_check_mark: Correct code:

var = 0


def foo(x, y):
    v = x + y
    return v
    # or
    return x + y

Rationale:

Used when a variable’s name hides a name defined in the outer scope.