Hacker News new | ask | show | jobs
by mortoray 3437 days 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.

2 comments

Why 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.

I'm sorry but that is fundamentally incorrect (and shows a big knowledge gap).

Interesting article though, thank you for posting it.