Re:Don’t Slurp: How to Read Files in Python
by chaosphere2112 on Friday September 27, 2013 @06:20PM
(#6459939)
Yeah, but aren't we actually supposed to do this?
[ Parent
| on HN ]
Re:Don’t Slurp: How to Read Files in Python
by scott_s on Friday September 27, 2013 @06:48PM
(#6460036)
Yes, and that is the idiomatic way to read files in Python. I guess me and the author are looking at different Python programs, because slurping the whole file is not "by far the most common way" I have seen files read in the wild.
Re:Don’t Slurp: How to Read Files in Python
by rprospero on Friday September 27, 2013 @07:08PM
(#6460109)
Most of my code slurps the entire file at a time. I can't actually think of any code we have that streams the code.
Then again, most of my files are three dimensional matrices. There's nothing I can really do on a line by line basis.