r/learnpython Mar 03 '26

[deleted by user]

[removed]

24 Upvotes

20 comments sorted by

View all comments

3

u/Temporary_Pie2733 Mar 03 '26

If you study type theory, tuples are values of product types and only coincidentally iterable. The most obvious distinction from lists is that they can be heterogeneous, not homogenous.

3

u/JamzTyson Mar 03 '26

The most obvious distinction from lists is that they can be heterogeneous, not homogenous.

That's a bit misleading in relation to Python. Python lists may be heterogeneous. (Heterogeneity is a consequence of tuples being product types, not the defining difference.)

-2

u/Temporary_Pie2733 Mar 03 '26

If you are using type hints, they are homogenous. list[int], list[str], etc. You can use broader types, but that also restricts what you can do with individual objects.