A tuple is an ordered, fixed-size collection of elements, possibly of different types. Simple enough, right? But they were not always part of our programming languages.
Although tuples existed in mathematics and theoretical languages, it was the functional programming language ML that, in 1970, introduced a data structure like this:
(1, "Hello")
The ML standard influenced many other languages, and Python developers will certainly recognize the structure.
For the longest time, I hated tuples. That probably was because they were anonymous in C#. Their values were called T1, T2, T3, and so on. Instead of using tuples, I wrote small data classes to pass data around. And when I switched to Python, I did the same. In Python, tuples are even more anonymous. You have to guess the meaning of their contents.
But then I was introduced to tuple unpacking.
Instead of treating a tuple like a mysterious box, I could give meaning to each value the moment I received it:
point = (10, 20)
x, y = point
Suddenly, the tuple was no longer anonymous. x and y were far more expressive than point[0] and point[1].
Slowly, I started to realize that tuples were not meant to replace classes. They solve a different problem. Classes are great when data has behavior, validation, or a long life in your code. Tuples shine when you need to group a few values temporarily and immediately unpack them into meaningful names.
Python leans heavily into this idea. Functions can return multiple values:
def divide(a, b):
return a // b, a % b
quotient, remainder = divide(10, 3)
No tiny helper class. No awkward result.T1 and result.T2. Just values, unpacked into names that explain themselves.
And for the first time, I stopped hating tuples.
Written by Loek van den Ouweland on March 31, 2026.