在测试一些代码时,出现错误:
TypeError:breadth_first_search()接受2到3个位置参数,但给出了4个
函数声明的参数位如下所示:
def breadth_first_search(self, id: int, level=None)
呼叫看起来像这样:
tree.breadth_first_search(parent_id)
据我所知,这应该是正确的。我不知道为什么它将我的一个论点(或两个论点,包括自我)解释为四个。我缺少什么东西吗?
-
为了完整起见,这是回溯:
Traceback (most recent call last):
File "test.py", line 4, in <module>
tree = FeatureQuery.load_feature_tree("general", inventory)
File "D:\Speechcraft\Python\core\ling_query.py", line 201, in load_feature_tree
FeatureQuery.load_feature_node_recursive(feature_inventory, tree, results, l)
File "D:\Speechcraft\Python\core\ling_query.py", line 221, in load_feature_node_recursive
parent = tree.breadth_first_search(parent_id)
File "D:\Speechcraft\Python\core\phonological_units.py", line 37, in breadth_first_search
return self.breadth_first_search(self, id, next_level)
TypeError: breadth_first_search() takes from 2 to 3 positional arguments but 4 were given