[Tutor] module versus file

Dave Kuhlman dkuhlman at rexx.com
Thu Jun 8 05:10:52 CEST 2006


On Wed, Jun 07, 2006 at 06:44:08PM -0400, Kermit Rose wrote:

[snip]
>   
>  
> Yes.  By some means that I don't remember I declared the file factor30.py
> in directory
> math\factoring 
>  
> to be a module.
>  

If you are importing a module from a directory other than your
current directory, then the directory is effectively a package.
In order to make a directory into a package, the directory must
contain a file named __init__.py.  

The file __init__.py can be empty or can contain code.  It will be
evaluated the first time (and only the first time) an application
imports the package or something in it.

Dave

[snip]

-- 
Dave Kuhlman
http://www.rexx.com/~dkuhlman


More information about the Tutor mailing list