Y
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
orf
3202 days ago
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
link
fiddlerwoaroof
3202 days ago
>>> print([1,2,3]) [1,2,3] >>> print(*[1,2,3]) 1 2 3
link
aisofteng
3202 days ago
That doesn't tell you anything about when the list is expanded.
link
dragonwriter
3202 days ago
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.)
link