-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmacro.py
47 lines (34 loc) · 933 Bytes
/
macro.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
RED = 0
BLUE = 1
square = 1 # bottom_right
angle = 2
class MySize:
def __init__(self, w, h):
self.w = w
self.h = h
# def __get__(self, instance, owner):
# return self.w, self.h
def get(self):
return self.w, self.h
def copy(self):
obj = MySize(self.w, self.h)
return obj
def __getitem__(self, item):
if item == 0:
return self.w
elif item == 1:
return self.h
else:
return None
def __lt__(self, other):
return self.w < other.w and self.h < other.h
def __le__(self, other):
return self.__lt__(other) or self.__eq__(other)
def __eq__(self, other):
return self.w == other.w and self.h == other.h
def __ne__(self, other):
pass
def __gt__(self, other):
return self.w > other.w and self.h > other.h
def __ge__(self, other):
pass