[Python-Dev] PEP 328 -- relative and multi-line import
Guido van Rossum
guido at python.org
Tue Mar 30 23:52:44 EST 2004
> I'd say count me seriously annoyed with the multiple dot idea, but
> I'm trying not to be annoyed (or annoying) on python-dev today. In
> general, I'm not a fan of relative imports; I'd rather stick to
> absolute imports all the time.
So don't use them!
> Given my general outlook, I think a variable number of dots is
> simply weird and would be hard to read. "Is that three or four
> dots?" I'd like to think the number of dots would be small, but
> I've spent a lot of time working on a project with packages
> hierarchies six levels deep.
The alternative, with a single dot, wouldn't make things better in
that case: a single dot would cause a search up until a match is
found, leaving the reader with even more to guess (plus more
possibilities for mistakes, if the same name occurs at multiple
levels). With multiple dots at least the author is likely to see how
silly it is to use relative import with more than two dots, and will
likely switch to absolute import.
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-Dev