Lazy "for line in f" ?

Alexandre Ferrieux alexandre.ferrieux at gmail.com
Mon Jul 23 12:37:47 CEST 2007


On Jul 23, 12:18 pm, Duncan Booth <duncan.bo... at invalid.invalid>
wrote:
>
> Whatever, the iterator makes the code both cleaner and faster. It is at
> the expense of not being suitable for interactive sessions, or in some
> cases pipes, but for those situations you can continue to use readline
> and the extra overhead in runtime will not likely be noticable.

But *why* is it so ? If Python calls fgets() which already has
internal buffering, why is the extra buffering gaining so much ?

-Alex




More information about the Python-list mailing list