Consider I have the following block of code in my program to read data from a large text file:
sets = []
for line in open(file, "r"):
sets.append(line.split()) # sets is a list of lists
I don't want to change the values in the lists. Because tuples are easier on memory and processor, should I be doing the following instead?
sets = []
for line in open(file, "r"):
sets.append(tuple(line.split())) # sets is a list of tuples
Or just use lists because the data is homogenous? If tuples are better, can I go overboard and do this:
sets = tuple(sets)