def scope_test():
    def do_local():
        spam="local spam"
    def do_nonlocal():
        nonlocal spam
        spam="non-local spam"
    def do_global():
        global spam
        spam="global spam"
    spam="test spam"
    do_local()
    print("After local assignment:", spam)
    do_nonlocal()
    print("After nonlocal assignment:", spam)
    do_global()
    print("After global assignment:", spam)

scope_test()
print("In global assignment:", spam)

出力はこうなる:

After local assignment: test spam
After nonlocal assignment: non-local spam
After global assignment: non-local spam
In global scope: global spam

らしいのですが、"After global assignment: non-local spam"となる理由がわかりません。なぜ、do_global(): global spamの次にあるのに、"global spam"ではなく"non-local spam"となるか、初心者でもわかるように、超簡単にご説明いただけないでしょうか。