1
0
mirror of https://github.com/adambard/learnxinyminutes-docs.git synced 2025-07-31 03:50:32 +02:00

Merge pull request #4757 from smith558/patch-9

[python/en] Clarify args and kwargs
This commit is contained in:
Marcel Ribeiro-Dantas
2023-09-21 19:33:34 -03:00
committed by GitHub

View File

@@ -603,7 +603,7 @@ all_the_args(1, 2, a=3, b=4) prints:
"""
# When calling functions, you can do the opposite of args/kwargs!
# Use * to expand tuples and use ** to expand kwargs.
# Use * to expand args (tuples) and use ** to expand kwargs (dictionaries).
args = (1, 2, 3, 4)
kwargs = {"a": 3, "b": 4}
all_the_args(*args) # equivalent: all_the_args(1, 2, 3, 4)