[Twisted-Python] Another nit on "Generalization of Deferred Execution in Python"

Jason Asbahr jason at asbahr.com
Fri Jan 17 17:25:23 EST 2003

On Friday, January 17, 2003, at 02:32 PM, Patrick K. O'Brien wrote:
> On Friday 17 January 2003 09:34 am, Tommi Virtanen wrote:
>> def prettyRequest(server, requestName):
>>     d=server.makeRequest(requestName)
>>     d.addCallback(lambda result: ', '.join(result.asList()))
>>     d.addErrback(lambda failure: failure.printTraceback())
>>     return d
>> 	I'm pretty sure everyone will consider that more readable.
> You've raised an issue I've wondered about as I've looked at some of 
> the
> Twisted source. There seems to be a fondness for returning large
> expressions, rather than building up a return value in a more piecemeal
> (and more easily read and understood) fashion. Is this simply a matter 
> of
> style, or is there something substantial going on here related to the
> nature of Twisted? My own code tends to look more like your second 
> example.

My code as well, favoring more, shorter lines for clarity.  I suspect 
the Twisted wizards don't even have to think about deferreds anymore, 
they just flow directly from mind to keyboard...  : )


More information about the Twisted-Python mailing list