Re: [Twisted-Python] A few comments on deferreds

Hi JP
"JP" == Jean-Paul Calderone <exarkun@divmod.com> writes: JP> On Fri, 6 Mar 2009 12:10:55 +0100, Terry Jones <terry@jon.es> wrote:
JP> Indeed. I can't think of any case where I've wanted to add more JP> callbacks to a Deferred after chaining it to (from? with?) another JP> Deferred. Right.
JP> But it would be catastrophic for error handling. Suddenly all of your JP> errors on d1 which are handled perfectly correctly with an errback on JP> d2 would become unhandled failures. Ah yes :-) Oops. If you really wanted to do this, you could use another helper function (e.g., Deferred.forkDeferred) which created and added a call/errback functions to d1 that called d2 call/errback and then returned its arg). I don't have a use case for that, so I'm not suggesting adding it to Twisted. Anyone who wanted that kind of deferred forking functionality could write it for themselves in a few lines.
JP> If this accounted for future changes to d2, it would make more sense. Yes. But as I mentioned, this mirrors the situation with d1.chainDeferred in which future changes to d1 are also probably useless. It feels to me like extending callbacks might be what people are expecting, as d1 then remains useful. (This leads to thoughts of a Deferred class that can't be fired, just used to accumulate callbacks that are solely used to extend other deferreds, but I guess deferreds are already abstract enough without going there...) JP> I think the correct direction to go in is to prevent people from trying JP> to add more callbacks to d1. Agreed. It's a simple change and it almost certainly flags a misunderstanding. I can open an issue and submit a patch if you like. Terry
participants (1)
-
Terry Jones