used-prior-global-declaration / E0118ΒΆ
Message emitted:
Name %r is used prior to global declaration
Description:
Emitted when a name is used prior a global declaration, which results in an error since Python 3.6.
Problematic code:
TOMATO = "black cherry"
def update_tomato():
print(TOMATO) # [used-prior-global-declaration]
global TOMATO
TOMATO = "cherry tomato"
Correct code:
TOMATO = "black cherry"
def update_tomato():
global TOMATO
TOMATO = "moneymaker"
Created by the basic checker.