-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbase.py
More file actions
47 lines (31 loc) · 803 Bytes
/
base.py
File metadata and controls
47 lines (31 loc) · 803 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
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env python3
# @file: base.py
# @auth: Sprax Lines
# @date: 2017-05-28 14:13:52 Sun 28 May
# Sprax Lines 2016.07.12 Written with Python 3.5
'''
inheritance and MRO -- TODO: spell it out
'''
class Base(object):
''' base class '''
def __init__(self, name):
self.name = name
def hi(self):
print("Hello, I'm %s!" % self.name)
class Derived(Base):
''' derived class '''
def __init__(self, name1, name2):
super().__init__(name1)
self.name += " " + name2
def hi(self):
print("Howdy, I'm %s!" % self.name)
class PrefixMixin(object):
''' prefix mixin class '''
pass
def main():
base = Base("joe")
base.hi()
derv = Derived("jerry", "hall")
derv.hi()
if __name__ == '__main__':
main()