Skip to Content
Advanced Python Programming - Second Edition
book

Advanced Python Programming - Second Edition

by Quan Nguyen
March 2022
Intermediate to advanced
606 pages
12h 25m
English
Packt Publishing
Content preview from Advanced Python Programming - Second Edition

Chapter 26: The Observer Pattern

We use the observer pattern when we want to be able to inform/notify all stakeholders (an object or a group of objects) when the state of an object changes. An important feature of the observer pattern is that the number of subscribers/observers, as well as who the subscribers are, may vary and can be changed at runtime.

In this chapter, we will learn about this design pattern while comparing it to a similar one we have seen in the past, known as the MVC pattern, and use it to implement a data formatter.

Specifically, we will cover the following topics:

  • Understanding the observer pattern
  • Real-world examples
  • Use cases
  • Implementation

Technical requirements

The code files for this chapter can be found at https://github.com/PacktPublishing/Advanced-Python-Programming-Second-Edition/tree/main/Chapter26 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Advanced Python Programming

Advanced Python Programming

Dr. Gabriele Lanaro, Quan Nguyen, Sakis Kasampalis
Expert Python Programming - Third Edition

Expert Python Programming - Third Edition

Michał Jaworski, Tarek Ziadé, Cody Jackson
Expert Python Programming - Fourth Edition

Expert Python Programming - Fourth Edition

Michał Jaworski, Tarek Ziade, Tarek Ziadé

Publisher Resources

ISBN: 9781801814010Supplemental Content