3 ms·
The `iter` form of the `readline` doesn't load the entire stream first, whereas the second form you posted does. This makes a significant difference when readin
by mortoray 10y ago
The `iter` form of the `readline` doesn't load the entire stream first, whereas the second form you posted does. This makes a significant difference when reading data from another program.
I saw that migration guide, but it has very few details about what is actually involved in migration. It doesn't include API change details.
- agf 10y agoWhy do you think the `for` loop form loads the whole stream? That shouldn't be true, since `for` just calls `iter` on the object internally, and normal file-like objects by default are iterated line-by-line. If you saw the migration guide but found it incomplete, you should edit your post to say that rather than saying there isn't one.
- orf 10y agoI'm sorry but that is fundamentally incorrect (and shows a big knowledge gap). Interesting article though, thank you for posting it.