ZhangZhihui's Blog  

Parameters in Function Definition

A. def func(name): Match by position or by name

B. def func(name=value): Default argument

C. def func(*args): Collect extra positional arguments in tuple named args

D. def func(**kwargs): Collect extra keyword arguments in dictionary named kwargs

E. def func(*args, name[=value]): Keyword-only arguments

F. def func(*, name[=value]): Keyword-only arguments

G. def func(name[=value], /): Positional-only arguments

 

Arguments in function call

H. func(value) Positional Argument

I. func(name=value) Keyword Argument

J. func(*x) Unpacks container x into positional arguments

K. func(**d) Unpacks dictionary d into keyword arguments

L. func(*x, *y, *z) Multiple unpackings

M. func(**d1, **d2, **d2) Multiple unpackings

posted on 2024-07-30 11:06  ZhangZhihuiAAA  阅读(8)  评论(0编辑  收藏  举报