title: How to find source code of python method in vscode
body: <p>I am using vscode and used the function </p>
  
  <pre class="lang-py prettyprint-override"><code>&gt;&gt;&gt; s = 'hello'
  &gt;&gt;&gt; s.capitalize()
  'Hello'
  </code></pre>
  
  <p>I was interested in seeing the source code for the function so I right clicked on <code>capitalize</code> and clicked <code>go to Definition</code>. This took me to <code>builtins.pyi</code> which seems to be a stub file. The function it gave me was</p>
  
  <pre class="lang-py prettyprint-override"><code>def capitalize(self) -&gt; str: ...
  </code></pre>
  
  <p>This isn't too helpful so I googled source code for python string library and got this</p>
  
  <pre class="lang-py prettyprint-override"><code># Capitalize the words in a string, e.g. " aBc  dEf " -&gt; "Abc Def".
  def capwords(s, sep=None):
      """capwords(s [,sep]) -&gt; string
      Split the argument into words using split, capitalize each
      word using capitalize, and join the capitalized words using
      join.  If the optional second argument sep is absent or None,
      runs of whitespace characters are replaced by a single space
      and leading and trailing whitespace are removed, otherwise
      sep is used to split and join the words.
      """
      return (sep or ' ').join(x.capitalize() for x in s.split(sep))
  </code></pre>
  
  <p>at the following link on github <a href="https://github.com/python/cpython/blob/3.7/Lib/string.py" rel="noreferrer">https://github.com/python/cpython/blob/3.7/Lib/string.py</a></p>
  
  <p>It looks like it calls <code>capitalize</code> but I can't seem to find the source code for this method. This is mainly just an example of me not being able to find the code for a method/function. I would like to be able to quickly see the source code from VScode when programming as it is a great way for me to learn. </p>
  
  <p>I realize this may be a very easy thing to do, but I have not been able to figure it out. If someone could point me in the right direction I would really appreciate it. </p>