Change in interpreted behaviour upon introduction of del keyword
问题 I wrote the following toy: def foo(): x = 5 def foo2(): print("Locals: ", locals()) print("Vars: ", vars()) print("dir: ", dir()) print("CP 1") print("x =", x) print("CP 2") print("Locals: ", locals()) print("Vars: ", vars()) print("dir: ", dir()) foo2() foo() print("-----------------------") def foo(): x = 5 def foo2(): print("Locals: ", locals()) print("Vars: ", vars()) print("dir: ", dir()) print("CP 1") print("x =", x) print("CP 2") del x print("Locals: ", locals()) print("Vars: ", vars()