This question is more about "appending" new items to a tuple, but I wanted to avoid using that word due to the immutable nature of tuples.
I am aware of two easy ways to concatenate tuples in Python, but I am curious which options is faster / more efficient or if they both behave the same on the low level.
1) Create a new tuple and concatenate them using +
operator:
oldTuple = (1, 2, 3)
value1 = 4
value2 = 5
result = oldTuple + (value1, value2)
2) Unpack the old tuple and construct a new one with the new items:
oldTuple = (1, 2, 3)
value1 = 4
value2 = 5
result = (*oldTuple, value1, value2)
Are both of these ways of tuple concatenation acceptable or is one of them better?
Is there a more efficient way to do this?
Would one become more / less efficient based on the length of the second tuple?