Suppose you were doing some sockets programming and had a strange bug - the code seemed to be stuck. Imagine something like this:

>>> s = socket . socket () >>> s . connect (( 'google.com' , 80 )) >>> fh = s . makefile () >>> fh . write ( 'GET / HTTP/1.0 \r

\r

' ) >>> fh . readline () # never returns

The problem is that the fileobject does buffering by default. The write call doesn't actually send anything unless we add fh.flush() around or change the buffering to be line-based ( makefile(bufsize=1) ) or completely disable it ( makefile(bufsize=0) ). Because HTTP is line-based protocol line buffering is best, example:

>>> s = socket . socket () >>> s . connect (( 'google.com' , 80 )) >>> fh = s . makefile ( bufsize = 1 ) >>> fh . write ( 'GET / HTTP/1.0 \r

\r

' ) >>> fh . readline () 'HTTP/1.0 302 Found\r

'

I don't like this non-linear learning curve and there are other situation where you don't have documentation around to figure out why stuff doesn't work. Sometimes, there's too much code to look at and you're left with a stuck server (or client) application.