该类的__init__
方法有 3 个参数,但是当我用 3 个参数实例化它时,它会抛出一个错误,它需要 1 个参数。我无法理解。
class ArrObj(frozenset):
def __init__(self, elem_list, elem_count, self_count):
super(ArrObj, self).__init__(elem_list) # Enums, ArrObj, race_id
self.elem_count = elem_count
self.self_count = self_count
assert self_count > 0
if __name__ == '__main__':
a = ArrObj(['a', 'b', 'c'], {'a':1, 'b':2, 'c':3}, 8)
Traceback (most recent call last):
File "G:/pycharm-projects/new_keyinfo/verify_treekeys.py", line 34, in <module>
a = ArrObj(['a', 'b', 'c'], {'a':1, 'b':2, 'c':3}, 8)
TypeError: ArrObj expected at most 1 arguments, got 3