Python *args / **kwargs
*args gathers extra positional arguments into a tuple, and **kwargs gathers extra keyword arguments into a dictionary. They suit flexible wrappers when the accepted behaviour remains clear.
Understand the idea
The names args and kwargs are conventions; the star syntax creates the behaviour. Use explicit parameters for required, well-known inputs rather than making every function accept anything. Forwarding collected arguments should preserve the called function's contract and should not silently discard unsupported options.
Where to try it
Open this example with Try in playground. The code loads as editable text and does not run until you select Run. The first run downloads Python. Each run starts fresh; temporary files created by a script are not files on your PC.
A worked example
def summary(title, *names, **options):
separator = options.get("separator", ", ")
return title + ": " + separator.join(names)
print(summary("Team", "Mira", "Dev", separator=" / "))
Read the result
The result is Team: Mira / Dev. names is a tuple and options is a dictionary.
Try one change
Reject unsupported option keys and explain whether explicit keyword-only parameters would be clearer here.