How to know more about built-in modules
<p><strong>OVERVIEW</strong></p>

<p>Once you've imported a package you can query the source path using the <code>__path__</code> attribute and from there most of the time you can read the Python source code directly. The problem comes when the module in question is similar to winreg. If I do</p>

<pre><code>import winreg

print winreg.__path__
</code></pre>

<p>I'll get the path <code>['d:\\virtual_envs\\py2711\\lib\\site-packages\\winreg']</code>, and from there I can take a look to its source code, where I can see the <code>__init__.py</code> is doing:</p>

<pre><code>from __future__ import absolute_import
from future.utils import PY3

if PY3:
    from winreg import *
else:
    __future_module__ = True
    from _winreg import *
</code></pre>

<p>Now, because I'm a very curious person I'd like to know more about the <code>_winreg</code> implementation so I try to do:</p>

<pre><code>import _winreg

print winreg
print dir(_winreg)
</code></pre>

<p>And I get <code>_winreg</code> is <code>&lt;module '_winreg' (built-in)&gt;</code>.</p>

<p>Is there a <em>standard</em> way to know in which part of the source code is implemented some built-in package like this so I'll be able to read and debug it?</p>

<p>For Python's modules written in C, you can always check CPython's source code over at GitHub: <a href="https://github.com/python/cpython" rel="nofollow">https://github.com/python/cpython</a></p>

<p>Usually you can find them in the <code>Modules</code> folder but the <code>winreg</code> one is special, here it is: <a href="https://github.com/python/cpython/blob/master/PC/winreg.c" rel="nofollow">https://github.com/python/cpython/blob/master/PC/winreg.c</a></p>

python built-in