title: python spyder editor autocompletion and inspection of modified classes with setattr
body: <p>after spending hours in googling, I learned a lot, but did not find any close topic to the following: </p>
  
  <p>I am currently programming on dynamically created classes via a factory method. The reason is, that the method names should be populated according to a separate yaml-file. It comes down to this problem:</p>
  
  <pre><code>def create_class_with_dynamic_fuction_name(fun_name):
      def fun(self):
          print "Hello, I am fun"
  
      class X:
          pass
  
      setattr(X, fun_name, fun)
      return X
  
  Kls1= create_class_with_dynamic_fuction_name('my_function_name')
  kls1= Kls1()
  kls1.my_function_name()
  </code></pre>
  
  <p>This code works. However, if you have this code in the editor of sypder (aka. Spider IDE, spyderlib), the autocomplete will not show <code>my_function_name</code> in its context box. Neither is it possible to inspect it via <code>Ctrl+I</code> for easy retrieval of the docstring-help.</p>
  
  <p>The same problem arises, if a class is created with <code>type(classname, (), clsdict)</code>. In that case, one only finds <code>mro</code> inside the autocomplete-context-menu. </p>
  
  <p>Also I found, that it is not a problem of the closure pattern above. You can do</p>
  
  <pre><code>def create_class_with_static_function_name():
      def fun(self):
          print "Hello, I am fun"
  
      class X:
          my_function_name = fun
  
      return X
  
  Kls2= create_class_with_static_function_name()
  kls2= Kls2()
  kls2.my_function_name()
  </code></pre>
  
  <p>In such case, the <code>my_function_name</code> shows correctly up, but it is not what I aimed for. </p>
  
  <p>Would be glad to here any suggestions to accomplish dynamic creation of classes with dynamic method names, which are correctly handled in spyder's autocompletion within the editor window.  </p>