For code:
#!/usr/bin/python src = \"\"\" print \'!!!\' import os \"\"\" obj = compile(src, \'\', \'exec\') eval(obj, {\'__builtins__\': False})
import calls the global/builtin __import__ function; if there isn't one to be found, import fails.
import
__import__
print does not rely on any globals to do its work. That is why print works in your example, even though you do not use the available __builtins__.
print
__builtins__