You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
377 B
25 lines
377 B
# delete local then try to reference it
|
|
def f():
|
|
x = 1
|
|
y = 2
|
|
print(x, y)
|
|
del x
|
|
print(y)
|
|
try:
|
|
print(x)
|
|
except NameError:
|
|
print("NameError");
|
|
f()
|
|
|
|
# delete local then try to delete it again
|
|
def g():
|
|
x = 3
|
|
y = 4
|
|
print(x, y)
|
|
del x
|
|
print(y)
|
|
try:
|
|
del x
|
|
except NameError:
|
|
print("NameError");
|
|
g()
|
|
|