title: What is the use of buffering in python's built-in open() function?
body: <p>Python Documentation : <a href="https://docs.python.org/2/library/functions.html#open" rel="noreferrer">https://docs.python.org/2/library/functions.html#open</a></p>
  
  <pre><code>open(name[, mode[, buffering]])  
  </code></pre>
  
  <p>The above documentation says "The optional buffering argument specifies the file’s desired buffer size: 0 means unbuffered, 1 means line buffered, any other positive value means use a buffer of (approximately) that size (in bytes). A negative buffering means to use the system default.If omitted, the system default is used.".<br>
    When I use   </p>
  
  <pre><code>filedata = open(file.txt,"r",0)  
  </code></pre>
  
  <p>or  </p>
  
  <pre><code>filedata = open(file.txt,"r",1)  
  </code></pre>
  
  <p>or  </p>
  
  <pre><code>filedata = open(file.txt,"r",2)
  </code></pre>
  
  <p>or</p>
  
  <pre><code>filedata = open(file.txt,"r",-1) 
  </code></pre>
  
  <p>or  </p>
  
  <pre><code>filedata = open(file.txt,"r")
  </code></pre>
  
  <p>The output has no change. Each line shown above prints at same speed.<br>
  output:</p>
  
  <blockquote>
    <p>Mr. Bean is a British television programme series of fifteen 25-</p>
    
    <p>minute episodes written by Robin Driscoll and starring Rowan Atkinson
    as </p>
    
    <p>the title character. Different episodes were also written by Robin </p>
    
    <p>Driscoll and Richard Curtis, and one by Ben Elton. Thirteen of the </p>
    
    <p>episodes were broadcast on ITV, from the pilot on 1 January 1990,
    until </p>
    
    <p>"Goodnight Mr. Bean" on 31 October 1995. A clip show, "The Best Bits
    of </p>
    
    <p>Mr. Bean", was broadcast on 15 December 1995, and one episode, "Hair
    by </p>
    
    <p>Mr. Bean of London", was not broadcast until 2006 on
    Nickelodeon.  </p>
  </blockquote>
  
  <p>Then how the buffering parameter in the open() function is useful? What
   value </p>
  
  <p>of that buffering parameter is best to use?</p>