[Python-ideas] Why not f(*my_list,*my_other_list) ?

Stefan Behnel stefan_ml at behnel.de
Fri Sep 10 19:16:52 CEST 2010


Benjamin Peterson, 10.09.2010 19:03:
> cool-RR<cool-rr at ...>  writes:
>
>>
>> I noticed that it's impossible to call a Python function with two starred
> argument lists, like this: `f(*my_list, *my_other_list)`. I mean, if someone
> wants to feed two lists of arguments into a function, why not?
>
> Okay, so why would you want to?

Well, it can happen. It doesn't merit a syntax extension, though. You can 
just do

     args_for_f = tuple(my_list) + tuple(my_other_list)

     f(*args_for_f)

(using tuple() here in case both are not really lists)

Stefan




More information about the Python-ideas mailing list