I'm trying to beef up my "best practices," and I'm reading more about lists vs. tuples and memory allocation, and how you should use tuples if the list is not going to be changed as the program runs.
That being said, should you (almost) always convert from a list into a tuple if this is the case?
For example, let's say I have this code, and I'm looking at 100 colors input from users:
with open("colors.txt", "r") as file:
lst = [line.strip() for line in file.readlines()]
I'm not planning on mutating the list. Does that mean I should follow with:
tup = tuple(lst)
and work off of tup
?
I realize this is a pretty small example, and converting to a tuple only takes 1 line, but is this the best practice? It just feels a little clunky since it's new to me.
Thanks!