On Fri, Feb 18, 2011 at 3:36 PM, Brett Cannon <br...@python.org> wrote: > It says they are "highly discouraged" because "absolute imports are > more portable and usually more readable", but now that people have had > a chance to use explicit relative imports, do people still believe > this? I mean if we truly believed this then why did we add the syntax? > I know I have used it and love it, let alone that I don't buy the > portability argument.
I've been living so long with versions of Python that didn't have explicit relative imports, I'd forgotten why I wanted them in in the first place. My initial reaction was that absolute imports are good enough, but that there are special cases where relative imports are needed and explicit relative imports address that need, so I'm sure we need the feature. Thinking about it more though, I *like* explicit relative imports because I think they can reduce the burden of reading the code. When you see: from . import foo You know that foo is local to (part of) this project. Of course, if you see: import thisproject.foo You know that foo is part of ``thisproject``, but you also have to remember that ``thisproject`` is *this* project. :) How useful this is can certainly be debated. I think I'd have to use the explicit relative import style in practice for a while before I was sure I liked it. I think I'll make a point of trying it out. Of course, the explicit relative import style makes moving packages around *somewhat* easier. I agree with Marc-Andre. We shouldn't worry too much about what PEP 8 says. Jim -- Jim Fulton http://www.linkedin.com/in/jimfulton _______________________________________________ python-committers mailing list python-committers@python.org http://mail.python.org/mailman/listinfo/python-committers