inflearn logo
Khóa học

Khóa học

Chia sẻ kiến thức

Bài viết của taeho7702

taeho7702 taeho7702

@taeho77028354

Số lượng đánh giá đã viết
2
Xếp hạng trung bình
5.0

Bài viết 2

Hỏi & Đáp

__del__ 작동 여부

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

Lượt thích
1
Số bình luận
4
Lượt xem
358

Hỏi & Đáp

__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)

Lượt thích
1
Số bình luận
4
Lượt xem
358