title: Monkey patch to raise AttributeError on attempted use of a particular attribute of an object
body: <p>I have an instance of a python class.</p>
  
  <pre><code>class Fum(object):
    foo = Foo()
    bar = Bar()
  
  fum = Fum()
  </code></pre>
  
  <p>For good reasons that I don't want to get into, I want to monkey patch this object so that one of its attributes is off-limits in a certain use case. I'd prefer that if I or another developer down the road tries to use the attribute on the monkey-patched object, a useful exception is raised which explains the situation. I tried to implement this with a property, but am not having luck. </p>
  
  <p>e.g.,</p>
  
  <pre><code>def raiser():
    raise AttributeError("Don't use this attribute on this object. Its disabled for X reason.")
  
  fum.bar = property(raiser)
  
  &gt;&gt;&gt; fum.bar
  &gt;&gt;&gt; &lt;property object at 0xb0b8b33f&gt;
  </code></pre>
  
  <p>What am I missing?</p>