2024-09-26 18:19:48 发布
网友
在方法定义中,为什么有人要将形式参数amount设置为形式参数列表中的常量PERMANENCE_INC?你知道吗
amount
PERMANENCE_INC
def increasePermanence(self, amount=PERMANENCE_INC): """ Increases the permanence of this synapse. """ self.permanence = min(1.0, self.permanence+amount)
此窗体使amount成为一个可选参数,默认值为PERMANENCE_INC。你知道吗
如果在调用函数时未提供参数,则为参数提供默认值。你知道吗
例如,要按默认值增加持久性,可以调用:
obj.increasePermanence()
此窗体使
amount
成为一个可选参数,默认值为PERMANENCE_INC
。你知道吗如果在调用函数时未提供参数,则为参数提供默认值。你知道吗
例如,要按默认值增加持久性,可以调用:
相关问题 更多 >
编程相关推荐