global-variable-not-assigned / W0602#

Message emitted:

Using global for %r but no assignment is done

Description:

Used when a variable is defined through the "global" statement but no assignment to this variable is done.

Problematic code:

TOMATO = "black cherry"


def update_tomato():
    global TOMATO  # [global-variable-not-assigned]
    print(TOMATO)

Correct code:

TOMATO = "black cherry"


def update_tomato():
    global TOMATO
    TOMATO = "moneymaker"

Created by the variables checker.