Hacker News new | ask | show | jobs
by drizze 3202 days ago
I think *iterable would just pass one argument that's a list, not pass each argument individually
3 comments

There may be some optimization at the interpreter level, but it appears to Python that each element of 'iterable' is passed as an individual argument

    >>> print([1,2,3])
    [1,2,3]
    >>> print(*[1,2,3])
    1 2 3
That doesn't tell you anything about when the list is expanded.
The asterisk at the call site (where it turns an iterable into multiple passed arguments) not the function definition site (where it collects otherwise unconsumed arguments into a single list.)