+ 2
Does tuples being faster but immutable really make them worth while compared to lists?
2 Réponses
+ 3
Yes, tuples are faster then lists.I think that tuples are superior to lists when you dont need append method for the data. For example, tuples can be used to collect 3D coordinates (x,y,z) or physical vector quantities, such as velocity or force (3 projections on 3 axes). In these cases you dont need to add additional 4th number into tuple because there is only 3 coordinate axes and dont need all that list functionality with append and insert methods.
+ 1
Think of them as constants; a tuple of engineering values or important set dates allows you to look them up quickly without worrying about the program accidentally changing them.