For this example, we will create an extremely simple implementation of several Unix commands:
rm. We are going to use them in our shell, which we will write sometime later. The killer feature of the shell will be the possibility to undo all the operations executed since the shell started. Let's use the Command design pattern to do it.
In this example, we will use the
abc module that provides the
abstractmethod decorator to make methods abstract, so that this method should be implemented in derived classes to instantiate them. Also, we need to assign
abc.ABCMeta to the
__metaclass__ class attribute to let the
abstractmethod decorator work. More information can be found in Python's standard library documentation ...