An Elegant Way To Perform Shutdown Tasks in Python
Often towards the end of a program's execution, we run a few basic tasks such as saving objects, printing logs, etc.
To invoke a method right before the interpreter is shutting down, decorate it with the @๐๐ญ๐๐ฑ๐ข๐ญ.๐ซ๐๐ ๐ข๐ฌ๐ญ๐๐ซ decorator.
The good thing is that it works even if the program gets terminated unexpectedly. Thus, you can use this method to save the state of the program or print any necessary details before it stops.
Read more: Documentation.
Share this post on LinkedIn: Post Link.
Find the code for my tips here:ย GitHub.
I like to explore, experiment and write about data science concepts and tools. You can read my articles on Medium. Also, you can connect with me on LinkedIn.


