Python·100 questions

When to use list and when to use tuple?

Answer
list — if you need to modify contents.
tuple — if data should be immutable.
tuple can be used as a dict key (if elements are hashable).
tuple is usually slightly more compact.
For returning “packets” of values, tuple is convenient.
Was this answer helpful?

More questions in this topic

Related questions from other topics