Paul Rubin <http://[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] writes: >> deferred = fetchPage('http://python.org') >> def _showResponse(response) >> print "fancy formatting: %s" % response.text >> deferred.addCallback(_showResponse) >> >> Lots of Twisted code has to be written backwards like this. > > But that's just ugly. The fetchPage function should take the callback > as an argument. In an asynchronous system it would even be buggy. > What happens if the page fetch completes before you add the callback? Or it should be trivial to give deferred a decorator method and write: @deferred.callback def _showResponse(response): ... -- http://mail.python.org/mailman/listinfo/python-list