(Sorry if this is a duplicate message). > Topic: Return a tuple of (status, headers, body) > ------------------------------------------------ > > That is, get rid of the start_response callable. The general consensus > was that this is a simple, but powerful improvement, which Rack/Jack > have demonstrated already. The "simplest possible application object" > would change from this: > > def simple_app(environ, start_response): > """Simplest possible application object""" > status = '200 OK' > response_headers = [('Content-type','text/plain')] > start_response(status, response_headers) > return ['Hello world!\n'] > > ...to this: > > def simple_app(environ): > """Simplest possible application object""" > status = '200 OK' > response_headers = [('Content-type','text/plain')] > body = ['Hello world!\n'] > return (status, response_headers, body)
Did you consider a variation that eliminates the start_response but returns status and headers as first item of the iterable? Considering how response is usually generated it could save some code in some cases and wouldn't add any overhead in others, it also has a pleasant similarity to the HTTP response format: def simple_app(environ): """Simplest possible application object""" status = '200 OK' response_headers = [('Content-type','text/plain')] yield status, response_headers yield 'Hello world!\n' Anyway, whichever way will be accepted they are easy to adapt to one another with a decorator. _______________________________________________ Web-SIG mailing list Web-SIG@python.org Web SIG: http://www.python.org/sigs/web-sig Unsubscribe: http://mail.python.org/mailman/options/web-sig/archive%40mail-archive.com