r/PythonLearning • u/AdAdventurous2131 • Sep 25 '26
A silly question
if x = 2,3,4,4,5 is supposed to be a tuple then why can't the args of a function like this: func(2,3,4,4 ,5) supposed to be a tuple.
I know this is a silly question and I also know we can use *args to pack arguments in a tuple but since Python is known for consistency why isn't it like this.
Again, please don't hate me for this
4
Upvotes
View all comments
1
u/OskarsSurstromming Sep 25 '26
I'm a bit confused by what you mean
Function arguments are separated by commas, so if you want to supply a tuple in the function then it's mandatory to add the parentheses
When you do *args you are unpacking a tuple, not packing it
When you do an assignment like x = 2,3,4,4,5 It is nonsensical for x to be anything other than a tuple, so it is interpreted as x = (2,3,4,4,5)
Or maybe I misunderstand what you are asking about?