title: Vim Python completion
body: <p>I'm having trouble with Vim and Python completion.
  In fact I'm totally confused how does this work.</p>
  
  <p>I have generic gvim 7.3, on windows 7 (with python/dyn)
  I'm using SuperTab plugin, amongst many others, some of which
  are python-specific, with following settings in vimrc:</p>
  
  <pre><code>au FileType python set omnifunc=pythoncomplete#Complete
  let g:SuperTabDefaultCompletionType = "context"
  let g:SuperTabContextDefaultCompletionType = "&lt;c-n&gt;"
  </code></pre>
  
  <p>I did not set PYTHONPATH enviroment varariable.</p>
  
  <p>Completion works ok for system modules.</p>
  
  <p>At first I thought that it isn't working at all for non-system
  code, but that's not the case.
  What is happening is best shown on following code:</p>
  
  <pre><code>import numpy.random   # if this line is commented completion in last line works
  
  class C(object):
      def __init__(self, x_):
          self.x=x_
  
      def getX(self):
          return self.x
  
      def pr(self):
          print 'ok'
  
  a=C(10)  # nothing changes if I put C() instead, even though it would be wrong
  a.  # here is completion in question
  </code></pre>
  
  <p>Problem is that completion works (a.&lt;tab&gt; suggests getX and pr) if import line is commented. But it there is import numpy.random, completion brakes down.
  Note: this import works normally when I run the code.</p>
  
  <p>What are prerequisites for Python completion?
  What's happening and what should I do to get completion working for Python.</p>
  
  <p>As I am (relatively) new to Vim, any suggestion is appreciated.</p>
  
  <p><strong>EDIT:</strong>
  It seems that the problem is in using a.b form in import. If I do from numpy import random, everything is ok. If this is reasonably easy to fix I would like to get a.b from to work too. But now that I know how to go around it that's not so important.</p>
  
  <p>Are there more unusual problem like this one so that I know what's happening in the future?</p>