Member Avatar

So if I want to store a list of items (such as a bunch of instances of a class), what's better to use: tuples or lists? I understand that lists are mutable, so what are the advantages to tuples?

Recommended Answers

All 2 Replies

Tuples are great for constants because you won't accidently change them, they're also faster and use less space then lists, iirc.

Zonr is right, that is what a tuple is for! You want to preserve the integrity of your data here.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.