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.

Correct code:

TOMATO = "black cherry"


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

Problematic code:

TOMATO = "black cherry"


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

Created by the variables checker.