[Tutor] module versus file
Kent Johnson
kent37 at tds.net
Thu Jun 8 11:54:42 CEST 2006
> From: Dave Kuhlman <dkuhlman at rexx.com>
>
> 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.
That's not quite right. If the module is in a directory that is in sys.path, it is just a plain module, not a package. If the module is in a subdirectory of a directory in sys.path, then the subdirectory is a package and requires an __init__.py file to be recognized as a package. There is a good discussion of modules and packages in the tutorial:
http://docs.python.org/tut/node8.html
Kent
More information about the Tutor
mailing list