クラスの属性を削除するには del
を使います.例えば,memo
属性と priority
属性を削除してみます.
from issue import Issue
issue1 = Issue('2nd Issue')
issue1.description = 'new problem'
issue1.memo = 'メモ'
for key, value in vars(issue1).items():
print(key, ':', value)
print('-------------------')
del issue1.memo
del issue1.priority
for key, value in vars(issue1).items():
print(key, ':', value)
subject : 2nd Issue description : new problem priority : 0 closed : False memo : メモ ------------------- subject : 2nd Issue description : new problem closed : False