r/learnpython • u/Immediate_Pin_8449 • Oct 12 '26
Tuples..I don’t get it
Hi crew, I’m a Python newbie and I just learned about the concept of tuples.
We can’t change them.if we want to store we have to start at the index we want + 1.
I just don’t get it. Why wouldn’t we just use lists? When would we ever need this?
99
Upvotes
View all comments
Show parent comment
4
u/helix0311 Oct 12 '26
Another point from big data applications: Python garbage collection treats tuples way differently. A tuple with only immutable members is only ever scanned once, then untracked, since it can never generate a cyclic reference. Garbage collection in Python is awfully slow, so if the majority of what you're working with are tuples, you can significantly benefit when one of the garbage collection cycles runs.
I am vastly over simplifying a super complex topic, but tuples are performant on both memory allocation AND the garbage collection cycles.