3 ms·
Others have already pointed out that looping over the lines in the file (which uses iterators) is the more obvious way to do it. But, there's an even better way
by scott_s 13y ago
Others have already pointed out that looping over the lines in the file (which uses iterators) is the more obvious way to do it. But, there's an even better way. Check out "Generator Tricks for System Programmers": http://www.dabeaz.com/generators/ http://www.dabeaz.com/generators/
It has been submitted to HN many times: https://www.hnsearch.com/search#request/all&q=generator+tricks+for+system+programmers https://www.hnsearch.com/search#request/all&q=generator+tric...