A question about yield
simon at brunningonline.net
Mon Nov 8 14:13:20 CET 2010
On 7 November 2010 18:14, Chris Rebert <clp2 at rebertia.com> wrote:
> On Sun, Nov 7, 2010 at 9:56 AM, chad <cdalten at gmail.com> wrote:
>> But what happens if the input file is say 250MB? Will all 250MB be
>> loaded into memory at once?
> No. As I said, the file will be read from 1 line at a time, on an
> as-needed basis; which is to say, "line-by-line".
IIRC, it's somewhere in between. Python will read the file in blocks.
If only *looks* like it's reading the file line by line.
More information about the Python-list