[Tutor] What does import really do?
jim stockford
jim at well.com
Tue Aug 15 04:11:31 CEST 2006
For example,
import os
import sys
My take is that one uses the import keyword in a
program.
The Python interpreter reads the program and
generates machine code.
The import keyword directs the Python interpreter
to find some library (which is not necessarily named,
certainly not necessarily named in the import
statement), get some portion of machine code from
the library, bind that machine code in current
program's process space, and integrate the names
of the imported machine code with the program's
namespace (probably keeping the namespace of
the imported code as a separate name domain).
I'm just guessing, of course. Can anyone explain
what is really going on under the hood? I'll be
grateful for a description of the behavior.
newbie
More information about the Tutor
mailing list