Skip to content
Advertisement

Tag: destructor

Destructor usage in python __del__()

Will the following not cause issue of freeing memory twice? Why is python3 destroying an object when it has already been destroyed by the programmer? Output: Answer By calling __del__() you’re just calling a method on the instance, without any special meaning. The __del__() method, both yours and by default does absolutely nothing. Moreover, it is not a destructor but

Segmentation fault in destructor with Python

I have made a class to represent my led strip, and I would like to switch off the strip when I stop it (aka when the program stops and the object is destroyed). Hence, as I would do in C++, I created a destructor to do that. But it looks like Python call it after it destroyed the object. Then

Advertisement