From 4a4497bf8e1333cb5e0de631e9d112b24b52896c Mon Sep 17 00:00:00 2001 From: Nettika Date: Tue, 22 Apr 2025 22:16:42 -0700 Subject: [PATCH] Make Dog a dataclass and create three dogs --- heaven.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/heaven.py b/heaven.py index 04533b2..5ccafff 100644 --- a/heaven.py +++ b/heaven.py @@ -1,6 +1,19 @@ +from dataclasses import dataclass + + +@dataclass class Dog: + name: str + def __del__(self): global heaven heaven.append(self) + heaven = [] + +if __name__ == "__main__": + Dog("Fido") + Dog("Rex") + Dog("Spot") + print(heaven)