I am wondering if there is a way to call a method before the object is finally "destroyed" - like some sort of event.
I am using a class and a static method. Since it is not an instantiated object, I cannot use del
and modify __del__
on it.
Is the object garbage collected at all if not instantiated?
For example:
class Test:
@staticmethod
def say_hello():
print("Hello")
def on_destroy(self):
print("Object was destroyed...")
Test.say_hello()
What I want to achieve is that the method on_destroy
will fire after say_hello
since I am using a static method.
I tried using __del__
and it is not being called.
Thansk for the help.