class的继承、wait函数重载。调用时 调用实例本身的函数
class Launcher(object):
def __init__(self, conf, restart_method='reload'):
self.conf = conf
self.restart_method = restart_method
def wait(self):
print ('Launcher')
class ServiceLauncher(Launcher):
"""Runs one or more service in a parent process."""
def __init__(self, conf, restart_method='reload'):
super(ServiceLauncher, self).__init__(
conf, restart_method=restart_method)
def wait(self):
print ('ServiceLauncher')
launcher = ServiceLauncher('test', restart_method='reload')
launcher.wait()
输出
C:\Users\Seadee\AppData\Local\Programs\Python\Python35\python.exe D:/python/project_test/my_class.py
ServiceLauncher
Process finished with exit code 0