Python Documentation : https://docs.python.org/2/library/functions.html#open
open(name[, mode[, buffering]])
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.".
When I use
filedata = open(file.txt,"r",0)
or
filedata = open(file.txt,"r",1)
or
filedata = open(file.txt,"r",2)
or
filedata = open(file.txt,"r",-1)
or
filedata = open(file.txt,"r")
The output has no change. Each line shown above prints at same speed.
output:
Mr. Bean is a British television programme series of fifteen 25-
minute episodes written by Robin Driscoll and starring Rowan Atkinson as
the title character. Different episodes were also written by Robin
Driscoll and Richard Curtis, and one by Ben Elton. Thirteen of the
episodes were broadcast on ITV, from the pilot on 1 January 1990, until
"Goodnight Mr. Bean" on 31 October 1995. A clip show, "The Best Bits of
Mr. Bean", was broadcast on 15 December 1995, and one episode, "Hair by
Mr. Bean of London", was not broadcast until 2006 on Nickelodeon.
Then how the buffering parameter in the open() function is useful? What value
of that buffering parameter is best to use?