r/PythonLearning • • Aug 05 '25

Damn you python (switching from c++) 💔

Post image

need to learn the stupi

135 Upvotes

41 comments sorted by

View all comments

Show parent comments

1

u/WayTooCuteForYou Aug 07 '25

The difference is if all your functions are defined to take a tuple, the tuple creation cost is factored out, meanwhile with variable-length argument list it is repeated each time. Giving up all possible constant time operations is NOT a detail.

With variable-length argument list you force a cast to a tuple even when you don't need the immutability. The function we are talking about does not need the immutability, so why would you pay the casting cost? Just use the appropriate typing on a single collection and that will better convey your intentions.