[Twisted-Python] tee method in twisted.internet.defer.py ?

Terry Jones terry at jon.es
Tue Nov 17 08:33:06 MST 2009


Is there a reason why the Deferred class doesn't have a tee method like the
following (untested)?

    def tee(self, d):
        def _cb(arg):
            d.callback(arg)
            return arg

        def _eb(arg):
            d.errback(arg)
            return arg

        return self.addCallbacks(_cb, _eb)

I suppose it could be called teeDeferred to correspond to chainDeferred.
And I guess it's clear what it does and why it's quite different from
chainDeferred. I at least would find it quite useful.

Terry




More information about the Twisted-Python mailing list