9 Decorators

MOtivation

  • Augment an object with additional functionality
  • Do not alter / rewrite existing code (Open Close principle)
  • Two options:
  • inherite required object
  • Decorator

Python Functional Decorators

  • Built into Python
  • Not general purpose decortor seen in Books.

Classic Decorator