Python 3 read() function

skip at skip at
Thu Dec 4 18:49:34 CET 2008

    >>> huge ="C:\HUGE_FILE.pcl",'r+b',0)

Why do you want to disable buffering?  From the help:

open(file, mode='r', buffering=None, encoding=None, errors=None,
     newline=None, closefd=True)
    Open file and return a stream.  Raise IOError upon failure.
    buffering is an optional integer used to set the buffering policy. By
    default full buffering is on. Pass 0 to switch buffering off (only
    allowed in binary mode), 1 to set line buffering, and an integer > 1
    for full buffering.

I think you will get better performance if you open the file without the
third arg:

    huge ="C:\HUGE_FILE.pcl",'r+b')

Skip Montanaro - skip at -

More information about the Python-list mailing list