In the Python 3.8 编程常见问题解答 https://docs.python.org/3.8/faq/programming.html#how-do-i-write-a-function-with-output-parameters-call-by-reference,我看到了下面的函数定义:
class callByRef:
def __init__(self, /, **args):
for key, value in args.items():
setattr(self, key, value)
缺少此内容Python 3.7 版本 https://docs.python.org/3.7/faq/programming.html#how-do-i-write-a-function-with-output-parameters-call-by-reference:
class callByRef:
def __init__(self, **args):
for (key, value) in args.items():
setattr(self, key, value)
这是什么新东西/
syntax?
它与一个有什么关系/
出现在help()
output?
Note: this https://stackoverflow.com/q/24735311/5353461 and this https://stackoverflow.com/questions/28243832/what-is-the-meaning-of-a-forward-slash-in-a-python-method-signature-as-show问题是关于help()
注解,而这个问题是关于新语法以及与help()
注解。