self _update_observers(def _update_observers(self)for observer in self observersobserver(this object has two properties thatwhen setcall the _update_observers method on itself all this method does is loop over the available observers and let each one know that something has changed in this casewe call the observer object directlythe object will have to implement __call__ to process the update this would not be possible in many object-oriented programming languagesbut it' useful shortcut in python that can help make our code more readable now let' implement simple observer objectthis one will just print out some state to the consoleclass consoleobserverdef __init__(selfinventory)self inventory inventory def __call__(self)print(self inventory productprint(self inventory quantitythere' nothing terribly exciting herethe observed object is set up in the initializerand when the observer is calledwe do "something we can test the observer in an interactive consolei inventory( consoleobserver(ii attach(ci product "widgetwidget quantity widget after attaching the observer to the inventory objectwhenever we change one of the two observed propertiesthe observer is called and its action is invoked we can even add two different observer instancesi inventory( consoleobserver(