title: How to determine the class of a descriptor?
body: <p>In this example code, I would like to determine if <code>x</code> is an instance of <code>TestProperty</code>:</p>
  
  <pre><code>class TestProperty(object):
      def __init__(self, name):
          self._name = name
  
      def __get__(self, instance, cls):
          return getattr(instance, self._name)
  
      def __set_(self, instance, value):
          setattr(instance, self._name, value)
  
  class Test(object):
      x = TestProperty("x")
  
  print isinstance(Test.x, TestProperty)
  </code></pre>
  
  <p>However, I get the following exception:</p>
  
  <pre><code>Traceback (most recent call last):
    File "/home/zenoss/testproperties.py", line 14, in &lt;module&gt;
      print isinstance(Test.x, TestProperty)
    File "/home/zenoss/testproperties.py", line 6, in __get__
      return getattr(instance, self._name)
  AttributeError: 'NoneType' object has no attribute 'x'
  </code></pre>
  
  <p>Is there anyway to tell if an attribute is an instance of a class when it is a descriptor?</p>