# showing who stopped the reactor def doSomethingAndStop(name): reactor.callLater(0, doDeferredThing, name) def doDeferredThing(name): d = What() d.addBoth(stopNow, name) def stopNow(result): reactor.stoppedBy = result reactor.stop() doSomethingAndStop("fred") reactor.run() print reactor.stoppedBy doSomethingAndStop("wilma") reactor.run() print reactor.stoppedBy