Summary

In this chapter, we learned that design patterns are useful abstractions that provide "best practice" solutions for common programming problems. We understood that design patterns in Python, due to its dynamic nature and built-in syntax, can look very different from their usual renditions in other languages. We discussed several patterns in detail, with examples, UML diagrams and a discussion of the differences between Python and statically typed object-oriented languages. We covered:

  • What design patterns are
  • The iterator pattern
  • The decorator pattern
  • The observer pattern
  • The strategy and state patterns
  • The template pattern

In the next chapter, we'll discuss several more useful design patterns and their application in Python.

Get Python 3 Object Oriented Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.