Q. 1
def func_param_with_var_args(name, *args, age): print("name=",end=""), print(name) print("args=",end=""), print(args) print("age=",end=""), print(age) func_param_with_var_args("정우성", "01012341234", "seoul", 20)
parameter 재배열
argument 변환
Q. 2
def func_param_with_kwargs(name, age, **kwargs, address=0): print("name=",end=""), print(name) print("age=",end=""), print(age) print("kwargs=",end=""), print(kwargs) print("address=",end=""), print(address) func_param_with_kwargs("정우성", "20", mobile="01012341234", address="seoul")
parameter 재배열
Q. 3
def mixed_params(name="아이유", *args, age, **kwargs, address): print("name=",end=""), print(name) print("args=",end=""), print(args) print("age=",end=""), print(age) print("kwargs=",end=""), print(kwargs) print("address=",end=""), print(address) mixed_params(20, "정우성", "01012341234", "male" ,mobile="01012341234", address="seoul")
parameter 재배열
https://docs.python.org/3/tutorial/controlflow.html#default-argument-values
https://getkt.com/blog/python-keyword-only-arguments/
If a parameter has a default value, all following parameters up until the “*” must also have a default value — this is a syntactic restriction that is not expressed by the grammar.
https://docs.python.org/3/reference/compound_stmts.html#function-definitions