Because global spam only brings in global scope variables. Not non local variables.
# This is global scope area spam = "global scope" def print_spam(): print(spam) # soon as you get into a function. It a local variable. def spam_it(): def update_spam(): # grabs spam from 1 layer down. nonlocal spam spam = "nonlocal" def update_global(): global spam spam = "global scope change" print_spam() spam = "local" print(spam) update_spam() print(spam) update_global() print_spam() spam_it()
99 percent of computer problems exists between chair and keyboard.