module confusion

Steven D'Aprano steve at
Fri Oct 5 17:48:25 CEST 2007

On Fri, 05 Oct 2007 07:37:34 -0400, Steve Holden wrote:

> Steven D'Aprano wrote:
>> On Fri, 05 Oct 2007 00:12:33 -0500, Robert Kern wrote:
>>> This is somewhat odd, because most modules aren't exposed that way.
>>> They are either in their own file and accessed by importing them
>>> directly, or they are inside a package.
>> Any time you say:
>> import parrot
>> in one of your modules, you export parrot to anything that
> subsequently

Well obviously you have to write the module before people import it. I 
didn't really think "you must obey the laws of time and space" needed to 
be explained.

>> imports your
>> module. (Unless you take specific steps to prevent it, for instance
>> with del parrot.)
> or the creation of an __all__ containing an exclusive list of names for
> export.


__all__ only effects names imported with "from module import *", it has 
no effect on "import module".

What was that again about avoiding "writing anything that will be 
misconstrued by newless cloobs unfortunate enough to reach this thread as 
a result of a search for meaningful information on Python imports"?


More information about the Python-list mailing list