inflearn logo
講義

講義

知識共有

taeho7702さんの投稿

taeho7702 taeho7702

@taeho77028354

レビュー投稿数
2
平均評価
5.0

投稿 2

Q&A

__del__ 작동 여부

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

いいね数
1
コメント数
4
閲覧数
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)

いいね数
1
コメント数
4
閲覧数
358