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

Tommi Virtanen tv at twistedmatrix.com
Fri Jan 17 10:34:45 EST 2003


	You call this "pretty"?

def prettyRequest(server, requestName):
    return server.makeRequest(requestName
        lambda result: ', '.join(result.asList())
        lambda failure: failure.printTraceback())

	How about

def prettyRequest(server, 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.

More information about the Twisted-Python mailing list