[Twisted-Python] inlineCallbacks cascading cancelling and more

Glyph Lefkowitz glyph at twistedmatrix.com
Mon Aug 16 16:04:02 EDT 2010

On Aug 16, 2010, at 1:34 AM, Sergey Magafurov wrote:

> At first, sorry for my bad english

No problem, Sergey.  I am sure that my Russian would be worse.

Ivan's response already covered a lot of the things I would say, but I did want to add a few things.

First, generally: the most important thing to provide here are unit tests with very clear documentation expressing why you would want these things to work.  The test code you provided is unclear because it does not succeed or fail, it just does some things, and then does some other things, without explaining why I would want to do those things.  Given that the implementation of Deferred is changing a lot now (see <http://twistedmatrix.com/trac/ticket/411>), if we agree with your features, the implementation may have to change completely.  So, it is important to have tests that describe just the behavior change, not the implementation.

More specifically:

> Wanted features:
> 1. Ability to delete callbacks (delCallbacks)

Can you please explain *why* you would want this?  Deleting callbacks from a Deferred would break a lot of assumptions about the way that Deferreds are used (at any particular point in the callback chain, you should be able to infer what the return type should be just by looking at the code, not running it).

So, it is very unlikely that we will add the ability to delete arbitrary callbacks.

> 3. Ability to add/del hooks on deferred's finishing with errback or callback (addFinalizer/delFinalizer)

You can already do this with weakref callbacks.  Why would you need Deferred to provide an alternate mechanism?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20100816/1d596468/attachment.htm 

More information about the Twisted-Python mailing list