From: Zooko O'Whielacronx Date: Wed, 23 May 2007 22:11:23 +0000 (-0700) Subject: add in-line doc that Josh wrote as he was trying to understand this code X-Git-Tag: allmydata-tahoe-0.3.0~61 X-Git-Url: https://git.rkrishnan.org/components/%22news.html/...?a=commitdiff_plain;h=80b09b6d5438128c08a7799dd1cac43cd183bf45;p=tahoe-lafs%2Ftahoe-lafs.git add in-line doc that Josh wrote as he was trying to understand this code --- diff --git a/src/allmydata/util/observer.py b/src/allmydata/util/observer.py index 97cfa3f5..01120816 100644 --- a/src/allmydata/util/observer.py +++ b/src/allmydata/util/observer.py @@ -3,6 +3,12 @@ from twisted.internet import defer from foolscap.eventual import eventually +"""The idiom we use is for the observed object to offer a method named +'when_something', which returns a deferred. That deferred will be fired when +something happens. The way this is typically implemented is that the observed +has an ObserverList whose when_fired method is called in the observed's +'when_something'.""" + class OneShotObserverList: """A one-shot event distributor.""" def __init__(self):