[Python-Dev] Iterable String Redux (aka String ABC)

Boris Borcic bborcic at gmail.com
Wed May 28 13:18:32 CEST 2008


Armin Ronacher wrote:
> 
> Basically *the* problematic situation with iterable strings is something like
> a `flatten` function that flattens out every iterable object except of strings.

To flesh out the span of your "something like", recently I had a WSGI-based app 
that to some request mistakenly returned a 200K string instead of the same 
wrapped as a 1-element list; and the WSGI layer -according to spec- served it 
back character by character. Which "worked" - and durably confused not only me 
but IIS and a network router as well.

While blame can certainly be assigned elsewhere - WSGI spec or implementation 
(wsgiref included) - unwelcome iterability of strings was a necessary cause.

Cheers, BB



More information about the Python-Dev mailing list