Docs for __init__.py?

David Goodger dgoodger at bigfoot.com
Sat Jul 15 17:34:20 EDT 2000


on 2000-07-15 07:03, Matthew Cline (matt at nightrealms.com) wrote:
> Specifically, does the package name have to corespond to the
> name of the directory that __init__.py is in?  Or is there
> some way for __init__.py to say "No, *this* is the name for the
> package?"

The directory name *is* the package name, just as the file name (less the
.py) is the module name. Otherwise, how would Python know what file to read
when importing a module, or what directory to access when importing a
package?

See Guido's essay at http://www.python.org/doc/essays/packages.html for a
more in-depth explanation.

-- 
David Goodger    dgoodger at bigfoot.com    Open-source projects:
 - The Go Tools Project: http://gotools.sourceforge.net
 (more to come!)




More information about the Python-list mailing list