¡@

Home 

python Programming Glossary: executereplacement1

how is this Strategy Pattern written in Python? (the sample in Wikipedia)

http://stackoverflow.com/questions/963965/how-is-this-strategy-pattern-written-in-python-the-sample-in-wikipedia

func def execute self print Original execution def executeReplacement1 print Strategy 1 def executeReplacement2 print Strategy 2 if.. __main__ strat0 StrategyExample strat1 StrategyExample executeReplacement1 strat2 StrategyExample executeReplacement2 strat0.execute strat1.execute.. instance only using types strat0.execute types.MethodType executeReplacement1 strat0 StrategyExample This will bind the new method to start0..