简化应用程序内部接口,提供一个单一接口以供外部(前端or客户侧)调用
1 class Valley: 2 3 def run(self): 4 self.pre_declare() 5 self.declare() 6 self.after_declare() 7 8 def pre_declare(self): 9 print(1) 10 11 def declare(self): 12 print(2) 13 14 def after_declare(self): 15 print(3) 16 17 18 def exec(): 19 """统一内部接口""" 20 Valley().run()