CPython loading modules into memory

sjbrown shandy.b at gmail.com
Wed Feb 11 22:30:30 CET 2009


Can someone describe the details of how Python loads modules into
memory?  I assume once the .py file is compiled to .pyc that it is
mmap'ed in.  But that assumption is very naive.  Maybe it uses an
anonymous mapping?  Maybe it does other special magic?  This is all
very alien to me, so if someone could explain it in terms that a
person who never usually worries about memory could understand, that
would be much appreciated.

Follow up: is this process different if the modules are loaded from a
zipfile?

If there is a link that covers this info, that'd be great too.



More information about the Python-list mailing list