I have a python object which wraps a sensitive and important resource on the system. I have a cleanup()
function which safely releases various locks used by the object.
I want to make sure that after a call to cleanup()
the object becomes unusable. Ideally, any call to any member function of the object would raises an exception. Is there a way to do this that does not involve checking a flag in every function?