-
Notifications
You must be signed in to change notification settings - Fork 0
/
Circle.py
69 lines (45 loc) · 1.25 KB
/
Circle.py
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
class Circle:
def __init__(self, radius):
self._radius = radius
@property
def radius(self):
print('Getting radius attribute')
return self._radius
@radius.setter
def radius(self, radius):
print('Setting radius attribute')
self._radius = radius
@radius.deleter
def radius(self):
print('Deleting radius attribute')
del self._radius
@property
def diameter(self):
return 2 * self._radius
@diameter.setter
def diameter(self, diameter):
self.radius = diameter/2
class A:
def a(self):
pass
class B(A)
def a1(self):
return 1
def a2(self):
return 2
class C(A):
def a1(self):
return 2
def a2(self):
return 1
class D(B, C):
pass
d = D()
d.a1()
d.a2()
L(D) = [D] + merge(L(B), L(C), [B,C])
L(B) = [B] + merge(L(A), [A]) = [B] + merge([A, O], [A]) = [B] + [A] + merge([O], []) = [B] + [A] + [O] = [B, A, O]
L(C) = [C] + merge(L(A), [A]) = [C, A, O]
L(A) = [A] + merge(L(O), [O]) = [A] + [O] = [A,O]
L(D) = [D] + merge([B, A, O], [C, A, O], [B, C]) = [D] + [B] + merge([A, O], [C, A, O], [C]) = [D, B] + merge([O], [C, O], [C], [A]) =
[D, B] + merge([C], [C, A, O]) = [D, B] + C + [A, O]