Python – Append a tuple to a list

python

Given a tuple (specifically, a functions varargs), I want to prepend a list containing one or more items, then call another function with the result as a list. So far, the best I've come up with is:

def fn(*args):
    l = ['foo', 'bar']
    l.extend(args)
    fn2(l)

Which, given Pythons usual terseness when it comes to this sort of thing, seems like it takes 2 more lines than it should. Is there a more pythonic way?

Best Answer

You can convert the tuple to a list, which will allow you to concatenate it to the other list. ie:

def fn(*args):
    fn2(['foo', 'bar'] + list(args))