KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
In the 2009 Wikipedia entry for the Strategy Pattern, there's a example written in PHP . Most other code samples do something like: a = Context.new(StrategyA.new) a.execute #=> Doing the task the normal way b = Context.new(StrategyB.new) b.execute #=> Doing the task alternatively c = Context.new(StrategyC.new) c.execute #=> Doing the task even more alternative In the Python code a different technique is used with a Submit button. I wonder what the Python code will look like if it also did it the way the other code samples do. Update: Can it be shorter using first-class functions in Python?
Tags (comma-separated)
Save Edits
Cancel