1

I am wondering if there is a module-wide destructor such that we can make use of it to finalize or call some specific shut down functions in a module?

For example, some handlers of the module logbook are created and pust into the stack (ex, handler1.push_application() and it is better to pop up those handlers when your program exit. It would be great to have some sort of automatically function-calls to do this and module-wide destructor is one of possible candidates I can think :)

1 Answer 1

6

The atexit module allows you to register cleanup functions that Python will perform on interpreter termination.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.