Suppose I have a really large Python class that can consume enough memory. The class has some method that is responsible for clearing some things when the interpreter exits and it registers with the atexit module:
import atexit
import os
class ReallyBigClass(object):
def __init__(self, cache_file):
self.cache_file = open(cache_file)
self.data = <some large chunk of data>
atexit.register(self.cleanup)
<insert other methods for manipulating self.data>
def cleanup(self):
os.remove(self.cache_file)
Different instances of this class can come and go throughout the life of the program. My questions:
atexit, , , del, ? , atexit.register() , ? , , atexit, ? , , ?