summaryrefslogtreecommitdiffstatshomepage
path: root/tests/basics/del_local.py
blob: 05aa98b424cc3fba5d20f215ccc57c25d0f48223 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# 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()