Does tuples being faster but immutable really make them worth while compared to lists? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Does tuples being faster but immutable really make them worth while compared to lists?

24th Jan 2016, 4:06 PM
brvsirrobin
2 Answers
+ 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.
3rd Jul 2016, 8:40 AM
ะะปะตะบัะตะน ะšะปะพั‡ะบะพะฒ
ะะปะตะบัะตะน ะšะปะพั‡ะบะพะฒ - avatar
+ 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.
12th Apr 2016, 2:40 PM
Brian