mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-24 10:01:38 +00:00
Merge pull request #4757 from smith558/patch-9
[python/en] Clarify args and kwargs
This commit is contained in:
commit
c6bca8aa52
@ -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!
|
# 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)
|
args = (1, 2, 3, 4)
|
||||||
kwargs = {"a": 3, "b": 4}
|
kwargs = {"a": 3, "b": 4}
|
||||||
all_the_args(*args) # equivalent: all_the_args(1, 2, 3, 4)
|
all_the_args(*args) # equivalent: all_the_args(1, 2, 3, 4)
|
||||||
|
Loading…
Reference in New Issue
Block a user