Add all elements of an iterable to list

Viewed 67548

Is there a more concise way of doing the following?

t = (1,2,3)
t2 = (4,5)

l.addAll(t)
l.addAll(t2)
print l # [1,2,3,4,5]

This is what I have tried so far: I would prefer to avoid passing in the list in the parameters.

def t_add(t,stuff):
    for x in t:
        stuff.append(x)
2 Answers
Related