[Python-Dev] Re: Christmas Wishlist

Barry Warsaw barry at python.org
Wed Dec 17 21:59:47 EST 2003


On Tue, 2003-12-16 at 05:32, Nick Coghlan wrote:

> If absolute imports were to be the only type allowed, then it would seem 
> that the only possible location for naming conflicts is in the _first_ 
> element.

True.

> So if I wanted to use two different third party modules, both of which 
> have unfortunately chosen the same name for the top-level package, the 
> only way to let them co-exist is to redo _all_ of the imports in one or 
> the other of them.
> 
> Whereas, if relative pathing is possible, I believe that all I have to 
> do is push them one level down in the package heirarchy (using distinct 
> names that I invent), and neither of them ever even knows about the 
> other's existence. I can get at both of them unambiguously, by using my 
> new top=level names, and neither package even knows that it is no longer 
> starting at the top of the import heirarchy.
> 
> Or is there some other solution being proposed to this problem, and I 
> just haven't understood it?

Has this ever happened to you in practice?

It seems like the way out would be to start adopting a Java-like
convention for package names.  The problem with that in current Python
is that you can't (easily) weave a package's contents from different
locations in the file system.

-Barry





More information about the Python-Dev mailing list