Ian Kelly, 10.09.2010 19:03:
On Fri, Sep 10, 2010 at 10:52 AM, MRAB<pyt...@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.

But I think it's still a rare enough use case to require

    f(*(tuple(my_list) + tuple(my_other_list)))

when you need it, although the concatenation would likely get split up and moved into an explicit variable anyway.

Stefan

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to