[Python-Dev] Re: Relative import
John J Lee
jjl at pobox.com
Wed Dec 17 18:08:17 EST 2003
On Wed, 17 Dec 2003, Werner Schiendl wrote:
> There should be some solution about from-less import however, to support the
> fully-qualified name syntax. For example, I prefer writing "struct.pack"
> over writing just "pack" because it is more explicit to the reader what
> happens. Or e. g. os.path.split is another example.
> Maybe just omit the dots for the name?
As Guido pointed out, it would be a shame to break the rule that 'import
x' currently lets you refer to plain old 'x'. And it would be ugly to
have '.x' appear in programs, I think (and Guido mentioned with
statements, though maybe he's kidding about that).
So, why not this?
from ... import x
More information about the Python-Dev