2025-09-10:仓库迁移
This commit is contained in:
13
7.函数/2.编写只接受关键字参数的函数.py
Normal file
13
7.函数/2.编写只接受关键字参数的函数.py
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
|
||||
# 在*参数和**参数之间,可以加入普通参数,这种普通参数被称为keyword_only参数
|
||||
def recv(maxsize, *, block):
|
||||
print("recv msg")
|
||||
pass
|
||||
|
||||
# 这类参数只能被指定输入,示例如下:
|
||||
recv(1024, True) # 报错TypeError
|
||||
recv(1024, block=True) # 正确
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user