Python: TypeError: unbound method list.copy() needs an argument

Python: TypeError: unbound method list.copy() needs an argument

给定以下来自 class 的方法(抱歉名称是德语),但主要问题是为什么在使用 [=12= 调用方法 listeEntfernen 时出现错误].我收到错误:类型错误:未绑定方法 list.copy() 需要一个参数。我已经尝试切换和删除 self 关键字并尝试从 class 调用该函数但不明白为什么它不会使用 list[x] 作为 liste2 中的参数listeEntfernen() 方法。

   def linkeSeite(self, ziel):
    erg_links = []
    erg_rechts = []
    laenge_k_rechts = 1
    laenge_k_links = 1

    while not erg_rechts:
        komb_rechts = itertools.combinations(self.gewichte, laenge_k_rechts)
        if laenge_k_rechts > len(self.gewichte) or ziel > sum(self.gewichte):
            return
        for x in komb_rechts:
            if sum(x) <= ziel:
                continue
            while not erg_links:
                liste_links = self.listeEntfernen(self.gewichte, list[x])
                komb_links = itertools.combinations(liste_links, laenge_k_links)
                if (sum(x) - ziel) in liste_links:
                    erg_links = sum(x) - ziel
                    erg_rechts = x
                    break
                for y in komb_links:
                    if sum(x) - ziel == sum(y):
                        erg_links = y
                        erg_rechts = x
                        break
            laenge_k_links += 1
    laenge_k_rechts += 1
    return [erg_links, erg_rechts]

def listeEntfernen(self, liste1, liste2):
    erg_liste = []
    liste2_kopie = liste2.copy()
    for i in liste1:
        if i not in liste2_kopie:
            erg_liste.append(i)
            continue
        liste2_kopie.remove(i)
    return erg_liste

不清楚 list[x] 的目的是什么。您没有变量 list,所以 list 仍然是内置对象,所以您可能打算 list(x).