[Python-Dev] Relative Package Imports
Barry A. Warsaw
firstname.lastname@example.org (Barry A. Warsaw)
Sun, 19 Sep 1999 03:01:29 -0400 (EDT)
>>>>> "TP" == Tim Peters <email@example.com> writes:
TP> + "import package.*" is Java's way of spelling "from package
TP> import *", and because of the preceding is the only way to get
TP> convenient local names for classes imported from other
TP> packages (note that can you can never import a package/module
TP> in Java; you can only import a type name). So most Java code
TP> will do the above as
TP> import java.awt.*;
TP> and end up importing a gazillion names. This sucks for the
TP> same reasons "import *" sucks in Python, although Java catches
TP> the name conflicts at compile time.
The interesting this is that, while the Java developers did this at
the language level, at the VM level, every class is "fully qualified";
you see the absolute path for every class name.
import pkg.pkg.* is the reason why you still have to have unique named
classes like PyThinging or JWiggie, and yup it sucks.