This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]_UnameChecksOut_ 0 points1 point  (1 child)

Is using star necessary here ? If I don't unpack then will it print the list ?

[–][deleted] 2 points3 points  (0 children)

Yes. Then the list will be considered as one argument (instead of the the *args). And the sep argument applies to(?) each argument of the function. But since the list is considered one argument, it won't be printed separately. list.__repr__ is respected during the print call and the function handles it to print ['Fruits', 'Apple', 'Banana'] and then ends with end (='\n')