2
所以我定义为这样的功能:如何在方法调用中使用关键字arg之后的非关键字arg?
def getDistnace(self, strings, parentD, nodeName, nodeDistance):
而且我与调用它:
Node.getDistnace(newNode, strings, parentD, nodeName=None, nodeDistance=None)
和
Node.getDistnace(node, strings=None, parentD=None, nodeName, nodeDistance)
这两者都是从2种不同功能。但我的问题是,我得到一个错误,说明有一个non-keyword arg after keyword arg
。
有没有办法解决这个错误?第一个Node.getDistnace
增加了strings
和parentD
到getDistance
,第二个Node.getDistnace
增加了nodeName
和nodeDistance
的功能。