[Python-Dev] question/comment about documentation of relative imports (original) (raw)
Nick Coghlan ncoghlan at gmail.com
Tue Oct 5 23:09:48 CEST 2010
- Previous message: [Python-Dev] question/comment about documentation of relative imports
- Next message: [Python-Dev] question/comment about documentation of relative imports
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Wed, Oct 6, 2010 at 4:21 AM, Guido van Rossum <guido at python.org> wrote:
On Tue, Oct 5, 2010 at 11:17 AM, Darren Dale <dsdale24 at gmail.com> wrote:
The issue is implementing a PEP with nice support for relative imports, and then documenting that it should never be used. Isn't this mostly historical? Until the new relative-import syntax was implemented there were various problems with relative imports. The short-term solution was to recommend not using them. The long-term solution was to implement an unambiguous syntax. Now it is time to withdraw the anti-recommendation. Of course, without going overboard -- I still find them an acquired taste; but they have their place.
Indeed, the objections raised in those FAQ entries mostly applied to the problems implicit relative imports could silently cause. Explicit relative imports will throw exceptions for those cases instead. They read like someone took the old text and just modified it to refer to explicit imports instead of implicit ones without softening the language at all.
The remaining scenarios we have that can lead to duplication of a module happen regardless of the import style you use*.
Cheers, Nick.
*For the curious - those scenarios relate to ending up with the same module present both as "main" and under its normal module name.
-- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
- Previous message: [Python-Dev] question/comment about documentation of relative imports
- Next message: [Python-Dev] question/comment about documentation of relative imports
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]