reading files in small chunks?

Felipe Almeida Lessa felipe.lessa at gmail.com
Fri Apr 14 01:49:21 EDT 2006


Em Sex, 2006-04-14 às 13:45 +0800, Rajesh Sathyamoorthy escreveu:
> I wanted to know why it is more efficient to read a file in smaller
> chunks ( using file() or open() )?

It's more efficient in some cases, and worse on others. It also depends
on how you implement the read loop. I won't elaborate too much here,
there are loads of sites and books that talk about this topic.

> If this is not done, will this lead to errors in the data read or just
> results in slower performance?

It doesn't corrupt anything, unless you have a buggy hardware.

-- 
Felipe.




More information about the Python-list mailing list