Although importing * from a future module is probably dangerous and should be avoided for the reasons John Zwink talks about, it was interesting to find out why this does not work. It works differently with the usual Python import syntax, which allows you to extract everything from a module using * .
You can see what happens by opening Lib/compiler/future.py in the Python installation directory: all import statements imported from __future__ are launched through a special parser that allows you to just try to import one of the predefined functions. From the source code of FutureParser :
features = ("nested_scopes", "generators", "division", "absolute_import", "with_statement", "print_function", "unicode_literals")
Basically, you were right to __future__ that importing from __future__ is a special case that is slightly different from the usual Python import process, but there are good reasons for this.
Marius
source share