소개
소개글이 비어있어요
게시글
질문&답변
__del__ 작동 여부
실행 결과는Truethis car deletedthis car deleted입니다
- 1
- 4
- 246
질문&답변
__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)
- 1
- 4
- 246