title: getattr vs. inspect.getmembers
body: <p>It is possible to grab an object attribute using either getattr(obj, attr) or inspect.getmembers(obj) and then filtering by name:</p>
  
  <pre><code>import inspect
  
  class Foo(object):
  
      def __init__(self):
  
          self.a = 100
  
      def method(self): pass
  
  foo = Foo()
  method_by_getattr = getattr(foo, 'method')
  
  foo_members = inspect.getmembers(foo) 
  method_by_inspect = [member[1] for member in foo_members 
                          if member[0] == "method"][0]
  
  print (id(method_by_getattr), method_by_getattr, type(method_by_getattr))
  print (id(method_by_inspect), method_by_inspect, type(method_by_inspect))
  
  a_by_getattr = getattr(foo, "a")
  a_by_inspect = [member[1] for member in foo_members
                          if member[0] == "a"][0]
  
  print (id(a_by_getattr), a_by_getattr, type(a_by_getattr))
  print (id(a_by_inspect), a_by_inspect, type(a_by_inspect))
  
  # (38842160L, &lt;bound method Foo.method of &lt;__main__.Foo object at 0x00000000025EF390&gt;&gt;, &lt;type 'instancemethod'&gt;)
  # (39673576L, &lt;bound method Foo.method of &lt;__main__.Foo object at 0x00000000025EF390&gt;&gt;, &lt;type 'instancemethod'&gt;)
  # (34072832L, 100, &lt;type 'int'&gt;)
  # (34072832L, 100, &lt;type 'int'&gt;)
  </code></pre>
  
  <p>For the 'a' attribute getattr and inspect.getmembers are returning the same object. But for the method 'method' they are returning different objects (as can be seen by the disparate id's).</p>
  
  <p>Why is this so?</p>