I just saw a comment from DSM to my answer to the question create a series of tuples using a for loop and forced me to wonder if there is any reason to use fileObj.readlines() over passing the fileObj to a list. Both gives the same result as far as I can see. The only difference is the readability but considering both are equally readable, what should be the preferred way?
Consider the two scenarios
#This will create a tuple of file lines
with open("yourfile") as fin:
tup = list(fin)
#This is a straight forward way to create a list of file lines
with open("yourfile") as fin:
tup = fin.readlines()
I tried to timeit, but it does not make much sense as they both have comparable performance.