summaryrefslogtreecommitdiffstatshomepage
path: root/tests/basics/del-attr.py
blob: 501c729ceb1afc8251b769b787902b9daa33e1e5 (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
26
27
28
# del a class attribute

del C.f
try:
    print(C.x)
except AttributeError:
    print("AttributeError")
try:
    del C.f
except AttributeError:
    print("AttributeError")

# del an instance attribute

c = C()

c.x = 1
print(c.x)

del c.x
try:
    print(c.x)
except AttributeError:
    print("AttributeError")
try:
    del c.x
except AttributeError:
    print("AttributeError")