I'm new to python.
I need a datastructure to contain a tuple of two elements:
file path. I need to be able to change their values from time to time, hence I'm not sure a tuple is a good idea as it is immutable, and every time I need to change it I can only create a new tuple and reference it instead of really changing its values, so we may have a memory issue here - a lot of tuples allocated.
On the other hand, I thought of a list , but a list isn't in fixed size , so potentially I can cause the user who is using the list to enter more than 2 elements (
file path), and it's not ideal.
Lastly I would also appreciate to reference each element in a reasonable name, i.e. instead of
list which maps to the date and
list which maps to the file path, I would prefer a readable solution like associative array in php:
tuple = array() tuple['Date'] = "12.6.15" tuple['FilePath] = "C:\somewhere\only\we\know"
What is the Pythonic way to handle such situation?