Re: [Twisted-Python] Simpler Twisted deferred code via decorated callbacks

2012-10-15 Thread Terry Jones
Here's a description of what the 'errback' decorator in my code does. (BTW, I've just updated it.) Here's normal Twisted errback code, assuming you do from twisted.web.client import getPage and from twisted.python import log. def logGetPageError(url): def handleError(failure, url):

Re: [Twisted-Python] Simpler Twisted deferred code via decorated callbacks

2012-10-15 Thread Terry Jones
Here's a description of what the 'callback' decorator in my code does. Here's some normal Twisted code, assuming you do from twisted.web.client import getPage (yes, getPage is kind-of obsolete, but it's a concrete and conceptually simple deferred-returning function I like to use in examples).

Re: [Twisted-Python] Simpler Twisted deferred code via decorated callbacks

2012-10-15 Thread Terry Jones
Hi Naveen > This is a really nice approach. I'm glad you like it. I've learned over the years to avoid decorators, but I nevertheless think these ones are promising. > Are there any downsides or functionality that can't be accomplished using > this approach? The main thing that's a little diffe

Re: [Twisted-Python] Simpler Twisted deferred code via decorated callbacks

2012-10-15 Thread Naveen Michaud-Agrawal
Hi Terry, This is a really nice approach. Thanks for sharing! Are there any downsides or functionality that can't be accomplished using this approach? This combined with the generator approach to deferreds will make it easier to reason about the code flow. Naveen On Sun, Oct 14, 2012 at 4:40 PM,