@@ -0,0 +1,636 @@
+import types%0A%0Aclass StrategyExample:%0A%09def __init__(self, func=None):%0A%09%09self.name = 'Strategy Example 0'%0A%09%09if func is not None:%0A%09%09%09self.execute = types.MethodType(func, self)%0A%0A%09def execute(self):%0A%09%09print(self.name)%0A%0Adef execute_replacement1(self):%0A%09print(self.name + 'from execute 1')%0A%0Adef execute_replacement2(self):%0A%09print(self.name + 'from execute 2')%0A%0A%0Aif __name__ == '__main__':%0A%09strat0 = StrategyExample()%0A%0A%09strat1 = StrategyExample(execute_replacement1)%0A%09strat1.name = 'Strategy Example 1'%0A%0A%09strat2 = StrategyExample(execute_replacement2)%0A%09strat2.name = 'Strategy Example 2'%0A%0A%09strat0.execute()%0A%09strat1.execute()%0A%09strat2.execute()%0A

Add strategy pattern