import in Python3.3

Steven D'Aprano steve+comp.lang.python at
Wed Mar 27 00:11:48 CET 2013

On Tue, 26 Mar 2013 12:33:54 -0400, Jerry Hill wrote:

> On Mon, Mar 25, 2013 at 11:49 PM, rocky <rocky at> wrote:
>>> On Sun, 24 Mar 2013 18:12:49 -0500, Fabian von Romberg wrote:
>>> > I have a package name collections and inside of my package I want to
>> I find this kind of thing sad: it feels to me that programmers are
>> working around somewhat arbitrary and changing restrictions. Rather
>> than avoid names like "collections", why not try to address the
>> underlying problem? There isn't an ambiguity here in my view: the
>> fullname is mypackage.collections
> You've said a couple of times now that the original author has a package
> named "mypackage" with a module "collections" in it.  As far as I can
> tell, that's untrue.  The original post claims to have a package named
> "collections", which is colliding with the builtin module of the same
> name.

Ah, that would be my fault. I was the first one to mention "mypackage", 
and I misread the OP's description.

Given that he has a *top-level* package "collections" which clashes with 
the collections in the standard library, there's no simple way to bypass 
his package and find the standard library collections module. When you 
have two top-level modules/packages with the same name, whichever one 
comes first in sys.path will shadow the second one.


More information about the Python-list mailing list