def pauseUnpause(n):
 d = defer.Deferred()
 def f(result):
  return result
 d.callback(1)
 d.pause()
 for i in xrange(n):
  d.addCallback(f)
  d.addErrback(f)
  d.addBoth(f)
  d.addCallbacks(f)
 d.unpause()

def pauseUnpause ( n ) : d = defer . Deferred ( ) def f ( result ) : return result d . callback ( 1 ) d . pause ( ) for i in xrange ( n ) : d . addCallback ( f ) d . addErrback ( f ) d . addBoth ( f ) d . addCallbacks ( f ) d . unpause ( )
adds the given number of callbacks/errbacks/both to a deferred while it is paused .