inflearn logo
Course

Course

Instructor

taeho7702's Posts

taeho7702 taeho7702

@taeho77028354

Reviews Written
2
Average Rating
5.0

Posts 2

Q&A

__del__ 작동 여부

실행 결과는 True this car deleted this car deleted 입니다

Likes
1
Comments
4
Viewcount
358

Q&A

__del__ 작동 여부

class Tesla(object): def __init__(self, owner, color): self.owner = owner self.color = color def __str__(self): return f"{self.color} color {self.owner}'s car" def __len__(self): return len(self.owner) def __del__(self): print("this car deleted") def __eq__(self, other): return self.color == other.color tesla = Tesla("A", "Yellow") tesla1 = Tesla("B", "Yellow") print(tesla == tesla1)

Likes
1
Comments
4
Viewcount
358