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

Ian Kelly ian.g.kelly at gmail.com
Fri Sep 10 13:03:54 EDT 2010


On Fri, Sep 10, 2010 at 10:52 AM, MRAB <python at mrabarnett.plus.com> wrote:
> On 10/09/2010 17:37, cool-RR wrote:
>>
>> 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?
>>
>> I understand why you can't have two stars in a function definition; But
>> why can't you have two (or more) stars in a function call?
>>
> Would there be any advantage over `f(*(my_list + my_other_list))`?

That fails if my_list and my_other_list are different types, whereas
the *args syntax happily accepts any iterable object.



More information about the Python-list mailing list