At 11:57 AM 10/5/2007 -0300, Rob De Almeida wrote:
>Phillip J. Eby wrote:
>>I mean that you can't write a WSGI 2.0 application using a single 
>>generator function, because it has to return a tuple, not an 
>>iterator.  This will discourage people from thinking "yield" is a 
>>good way to build up their output, instead of using a StringIO or 
>>''.join() on a list of strings.
>
>Could you explain why using 'yield' is not recommended? Just 
>curious, because I use it all the time.

Because you're slowing down your application's throughput.  The only 
reasons to yield multiple strings is when you are either:

1. Sending a file that's larger than you want to load into memory, or

2. You're doing "server push" and need to do some processing between payloads.

_______________________________________________
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

Reply via email to