根据inspect模块官文文档中关于函数参数类型的相关说明,python函数参数共有五种类型,按顺序分别为:POSITIONAL_ONLY.POSITIONAL_OR_KEYWORD.VAR_POSITIONAL.KEYWORD_ONLY.VAR_KEYWORD.如图: POSITIONAL_ONLY:参数值必须以位置参数的形式传递.python没有明确的语法来定义POSITIONAL_ONLY类型的参数,但很多内建或扩展模块的函数中常常会接收这种参数类型,实际使用中不多见,这里暂不考虑. PO
add by zhj: 在Python文档中清楚的说明了默认参数是怎么工作的,如下 "Default parameter values are evaluated when the function definition is executed. This means that the expression is evaluated once, when the function is defined, and that the same “pre-computed” value is used