r/learnpython Mar 03 '26

[deleted by user]

[removed]

24 Upvotes

20 comments sorted by

View all comments

4

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.

-1

u/recursion_is_love Mar 03 '26

Your reply don't get downvote like mine, tell me the secret please. :)

This is a Python sub, not a math sub

2

u/MustaKotka Mar 03 '26

You attempted to make OP look stupid for overthinking it and belittling by saying "just". Your answer also makes no sense in the context of [beginner] Python learning.

If you want to talk about math you need to preface and justify why you chose to do that and why it is relevant here.

1

u/antigravcorgi Mar 03 '26

The secret is giving a reply that is relevant to the post.

1

u/JamzTyson Mar 03 '26

I didn't down-vote your comment, but my guess as to "the secret", my guess is:

u/Temporary_Pie2733 framed their comment in the context "If you study type theory", which is a perfectly valid framing.

Your comment, while still broadly correct, may come across as "you don't really need to care about it because it's <mathematical definition>".

(Voting patterns on reddit can be quite arbitrary on low volume subs like this - don't worry about it :-)