Aspect-oriented programming

Parts of aspect-oriented programming (AOP) are implemented by decorators in Python. Our purpose here is to leverage a few aspect-oriented concepts to help show the purpose of decorators and mixins in Python. The idea of a cross-cutting concern is central to AOP. While the Wikipedia page (http://en.wikipedia.org/wiki/Cross-cutting_concern) is generally kept up-to-date, older information is available here: https://web.archive.org/web/20150919015041/http://www.aosd.net/wiki/index.php?title=Glossary. The Spring framework provides some ideas; see also https://docs.spring.io/spring-python/1.2.x/sphinx/html/aop.html. There are several common examples of cross-cutting concerns, as follows:

  • Logging: We often need to have ...

Get Mastering Object-Oriented Python - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.