-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmixin.py
More file actions
35 lines (27 loc) · 741 Bytes
/
Copy pathmixin.py
File metadata and controls
35 lines (27 loc) · 741 Bytes
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
class LoggingMixin:
@classmethod
def info(cls):
print(f"[LoggingMixin]: info")
def log(self):
print(f"[LoggingMixin]: log")
def debug(self):
print(f"[LoggingMixin]: debug")
class DebugMixin:
def debug(self):
print(f"[DebugMixin]: debug")
def error(self):
print(f"[DebugMixin]: error")
class Service(LoggingMixin, DebugMixin):
def __init__(self):
pass
service = Service()
Service.info()
# [LoggingMixin]: info
service.log()
# [LoggingMixin]: log
service.debug()
# [LoggingMixin]: debug
service.error()
# [DebugMixin]: error
print(Service.mro())
# (<class '__main__.Service'>, <class '__main__.LoggingMixin'>, <class '__main__.DebugMixin'>, <class 'object'>)