summaryrefslogtreecommitdiffstatshomepage
path: root/tests/basics/builtin_delattr.py
blob: 3743df227cf28c0f5bbecda8a3fae6f0a9eed164 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# test builtin delattr

class A: pass
a = A()
a.x = 1
print(a.x)

delattr(a, 'x')

try:
    a.x
except AttributeError:
    print('AttributeError')

try:
    delattr(a, 'x')
except AttributeError:
    print('AttributeError')