observer pattern class concreteobserver(observer)def update(selfobserved)print("observingobservedclass observable(object)def __init__(self)self observers set(def register(selfobserver)self observers add(observerdef unregister(selfobserver)self observers discard(observerdef unregister_all(self)self observers set(def update_all(self)for observer in self observersobserver update(selfthe use of the abstract base class results in java-like interface that forces the observers to implement the update(method as we have seen beforethere is no need for the abstract base classbecause of python' dynamic natureand as such the preceding code can be replaced by more pythonic versionclass concreteobserver(object)def update(selfobserved)print("observingobservedclass observable(object)def __init__(self)self observers set(def register(selfobserver)self observers add(observer