On Jul 23, 10:33 am, Duncan Booth <[EMAIL PROTECTED]> wrote: > > The extra buffering means that iterating over a file is about 3 times > faster than repeatedly calling readline. > > while 1: > line = f.readline() > if not line: > break > > for line in f: > pass >
Surely you'll notice that the comparison is spoilt by the fact that the readline version needs an interpreted test each turn around. A more interesting test would be the C-implemented iterator, just calling fgets() (the thin layer policy) without extra 8k-blocking. -Alex -- http://mail.python.org/mailman/listinfo/python-list
