57.5k views
3 votes
When will you need to use a tuple data structure rather than a list of data structure​

1 Answer

4 votes

Answer:

They can always be easily promoted to named tuples. Likewise, if the collection is going to be iterated over, I prefer a list. If it's just a container to hold multiple objects as one, I prefer a tuple. The first thing you need to decide is whether the data structure needs to be mutable or not

User MohitGhodasara
by
5.3k points