Sep-24-2021, 05:43 PM
I have a problem with PyCharm. The Desctructor Method gets initialized, without it even been called. If I try it in the Python IDLE the intepreter doesn´t iniatialize the method, but it in PyCharm it does do it
class Vehicle:
def __init__(self, nme, ve):
self.name = nme
self.velocity = ve
def __del__(self):
print("Object", self.name, "got deleted")
def beschleunigen(self, value):
self.velocity += value
self.output()
def output(self):
print(self.name, self.velocity, "km/h")
# Objekte der Klasse erzeugen
car1 = Vehicle("Ford",40)
car2 = Vehicle("BMW", 45)
# Objekte betrachten
car1.output()
car2.output()Output:Ford 40 km/h
BMW 45 km/h
Object Ford got deleted
Object BMW got deletedCan somebody help me?
