for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
from abc import abstractmethod
class Command(object):
@abstractmethod
def do(self):
pass
class UndoableCommand(object):
def undo(self):
class CommandManager(object):
def __init__(self, stack):
self.stack = stack
def execute(self, command):
self.stack.push(command)
command.do()
if self.stack.count > 0:
self.stack.pop().undo()