[Twisted-Python] Current callback best practices

Hynek Schlawack hs at ox.cx
Wed Apr 3 07:25:51 EDT 2013

Am 02.04.2013 um 16:32 schrieb Glyph <glyph at twistedmatrix.com>:

>> My question can be simplified to: Closures yes or no?
> "As appropriate".

I had that coming. :)


Thanks for your verbose explanations!

>> If “yes, closures”: Still using cb/eb prefixes? I don’t see them very often in recent examples. What about addBoth handlers?
> If you're using a closure, use a descriptive name.  The 'cb/eb' prefix notation is not particularly illustrative; I often use an english word like 'when'.  whenDisconnected, whenResponseReceived, etc.

So you’re cool with calling callbacks after the event that triggered? That would’ve been my second question but I didn’t want it to divert the discussion. I kind of like `onData` et al too but the Twisted examples rather shun it.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20130403/8b9d05b3/attachment.htm 

More information about the Twisted-Python mailing list