I was looking for a Command pattern implementation in Python... (According to Wikipedia,
the command pattern is a design pattern in which an object is used to represent and encapsulate all the information needed to call a method at a later time.
)
The only thing I found was Command Dispatch pattern:
class Dispatcher:
def do_get(self): ...
def do_put(self): ...
def error(self): ...
def dispatch(self, command):
mname = 'do_' + command
if hasattr(self, mname):
method = getattr(self, mname)
method()
else:
self.error()
May be I'm wrong, but it looks like these are two different concepts, which accidentally have similar names.
Am i missing something?