1818
1919
2020class Observable (object ):
21- """
22- Provide notification support for classes that maintain dynamic associations with multiple
23- clients.
21+ """Provide notification support for classes that maintain dynamic
22+ associations with multiple clients.
2423
2524 Observers, i.e. clients of the observable, register event handlers that will be invoked to
2625 notify them whenever something interesting happens to the observable. The nature of what is
@@ -41,9 +40,7 @@ class Observable(object):
4140
4241
4342 def notify (self , other = ()):
44- """
45- Notify all observers
46- """
43+ """Notify all observers."""
4744 # build a list before notification, just in case the observer's callback behavior
4845 # involves removing itself from our callback set
4946 semaphors = (self ,) + other
@@ -54,27 +51,21 @@ def notify(self, other=()):
5451
5552 # callback management
5653 def addObserver (self , callable ):
57- """
58- Add callable to the set of observers
59- """
54+ """Add callable to the set of observers."""
6055 f = weak_ref (callable , fallback = _fbRemoveObserver )
6156 self ._observers .add (f )
6257 return
6358
6459
6560 def removeObserver (self , callable ):
66- """
67- Remove callable from the set of observers
68- """
61+ """Remove callable from the set of observers."""
6962 f = weak_ref (callable )
7063 self ._observers .remove (f )
7164 return
7265
7366
7467 def hasObserver (self , callable ):
75- """
76- True if `callable` is present in the set of observers.
77- """
68+ """True if `callable` is present in the set of observers."""
7869 f = weak_ref (callable )
7970 rv = f in self ._observers
8071 return rv
0 commit comments