title: Disable class instance methods
body: <p>How can I quickly disable all methods in a class instance based on a condition? My naive solution is to override using the <code>__getattr__</code> but this is not called when the function name exists already.</p>
  
  <pre><code>class my():
      def method1(self):
          print 'method1'
      def method2(self):
          print 'method2'
      def __getattr__(self, name):
          print 'Fetching '+str(name)
          if self.isValid():
              return getattr(self, name)
      def isValid(self):
          return False
  if __name__ == '__main__':
      m=my()
      m.method1()
  </code></pre>