Currently, I just read the file in using the plain old open function, but I'm wondering if it would be better to just get the lines I need using linecache.getline.
I could just read the lines I need and then keep adding lines as I need them to a list of retrieved lines.
The bad part would be if I ever do the AST parsing, I'll still need to read the full file in. And it also would be a bit more complex to keep track of reading in the lines and going through them to find the full codeblock I want
Currently, I just read the file in using the plain old
open
function, but I'm wondering if it would be better to just get the lines I need usinglinecache.getline
.I could just read the lines I need and then keep adding lines as I need them to a list of retrieved lines.
The bad part would be if I ever do the AST parsing, I'll still need to read the full file in. And it also would be a bit more complex to keep track of reading in the lines and going through them to find the full codeblock I want