I just stumbled across this unexpected behavior in python (both 2.7 and 3.x):
>>> import re as regexp
>>> regexp
You cannot treat the module name in import statements as variables. If that was the case, surely your initial import would fail because re is not yet a declared variable. Basically the import statement is semantic sugar; it is a statement of its own with its own rules.
One such rule is this: The written module name is understood as if it was a string. That is, it does not lookup a variable with the name re, instead it uses the string value 're' directly as the sought after module name. It then searches for a module/package (file) with this name and does the import.
This is the only situation (Edit: Well, see the discussion in the comments...) in the language where this behavior is seen, which is the cause of the confusion. Consider this alternative syntax, which is much more in line with the rest of the Python language:
import 're'
# Or alternatively
module_name = 're'
import module_name
Here, variable expansion is assumed in the import statement. As we know this is not the syntax which was actually chosen for the import statement. One can discuss which syntax is the better one, but the above is definitely more harmonious with the rest of the language syntax.