title: Get method wrapped in a descriptor with getattr
body: <p>I have the following descriptor, which saves the configuration inside my class after a method which is annotated with <code>@saveconfig</code> is called:</p>
  
  <pre><code>class saveconfig(object):
      def __init__(self, f):
          self.f = f
  
      def __get__(self, instance, owner):
          def wrapper(*args):
              self.f(instance, *args)
              instance.cfg.write()
              instance.paramcfg.write()
          return wrapper
  </code></pre>
  
  <p>It's used like this:</p>
  
  <pre><code>class pbtools():
      @saveconfig
      def getip(self, ip):
          (...)
  </code></pre>
  
  <p>It works fine. Now i want to get the decorated method by using getattr. But since the method is wrapped by the descriptor, i only get <code>wrapper</code> as a result:</p>
  
  <pre><code>pbt = pbtools()
  # results in "&lt;function wrapper at 0x23cced8&gt;:"
  method = getattr(pbt, "getip")
  </code></pre>
  
  <p>How can i access the wrapped method <code>getip</code> with getattr, to be able to call it by it's name? (of course i cannot access the method directly otherwise i would not have to do that).</p>
  
  <p><strong>Additional explanation:</strong></p>
  
  <p>The script is called from commandline. I have to map a command line parameter (string) to a method with the same name to invoke it. Furthermore, i have to map any additional parameters from the comamndline to parameters of the method, like this:</p>
  
  <pre><code>pbtools getip 192.168.178.123 #-&gt; calls getip with parameter 192.168.178.123
  </code></pre>
  
  <p>Since i cannot get the original method, i don't know how many parameters it has to map them. I have several methods that are decorated like that, because i want to move the cross cutting concern of saving the config out of the methods in the pbtools-class. </p>