This may be silly, but it\'s been nagging the back of my brain for a while.
Python gives us two built-in ways to delete attributes from objects, the del
Consider the following examples:
for name in ATTRIBUTES:
delattr(obj, name)
or:
def _cleanup(self, name):
"""Do cleanup for an attribute"""
value = getattr(self, name)
self._pre_cleanup(name, value)
delattr(self, name)
self._post_cleanup(name, value)
You can't do it with del.