Decorator: Attach additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extending functionality.
I subclass ABC
and used the @abstractmethod
decorator from the
abc
module here but do not use any of this functionality -
it just serves as documentation.
The python decorator syntax decorator syntax looks quite different as in python you call the decorated function and the decorating function is automatically called first whereas the decorating function must be called according to the pattern in the book.
python coffee.py