Mam obiekt klasy python i chcę, aby przypisać wartość jednej klasy zmiennejPython AttributeError na __del__
class Groupclass(Workerclass):
"""worker class"""
count = 0
def __init__(self):
"""initialize time"""
Groupclass.count += 1
self.membercount = 0;
self.members = []
def __del__(self):
"""delte a worker data"""
Groupclass.count -= 1
if __name__ == "__main__":
group1 = Groupclass()
Ten wynik wykonanie jest poprawne, ale jest komunikat o błędzie, który mówi:
Exception AttributeError: "'NoneType' object has no attribute 'count'" in <bound method Groupclass.__del__ of <__main__.Groupclass instance at 0x00BA6710>> ignored
Czy ktoś może mi powiedzieć, co zrobiłem źle?
Twoja klasa bazowa 'Workerclass' wydaje się mieć metodę' __del__', która próbuje coś zrobić z 'count', ale nie udostępniłeś tej metody tutaj. –
Przepraszam, nie wiem, że to związane ... –
Twoja wiadomość jest tylko ostrzeżeniem, to nie jest błąd. ** Coś ** w metodzie '__del__' próbowało zrobić coś z atrybutem' count' i nie powiodło się. –