1class Number:
2
3 def __init__(self, number):
4 self.__number = number
5
6 def get_number(self):
7 print("Getting...")
8 return self.__number
9
10 def set_number(self, number):
11 print("Setting...")
12 self.__number = number
13
14 def del_number(self):
15 print("Deleting...")
16 del self.__number
17
18 nb = property()
19 nb = nb.getter(get_number)
20 nb = nb.setter(set_number)
21 nb = nb.deleter(del_number)
22
23n = Number(42)
24
25print(n.nb)
26n.nb = 69
27print(n.nb)
28del n.nb
29
30# Getting...
31# 42
32# Setting...
33# Getting...
34# 69
35# Deleting...