seeking the "Hello World" of Packages

Bell, Kevin kevin.bell at slcgov.com
Fri Aug 11 13:48:04 EDT 2006


I'm trying to get an idea of how packages work and I've read about it in
the Py Tutorial and Nutshell, but I'm still craving a concrete example
that I can poke through.  Does anyone have a really basic package that
does very little that I could look at?

What I've gathered thus far is that a package is simply a directory, say
C:\MyPackage, that would contain __init__.py which tells Python to be
aware of all the other modules in C:\MyPackage.  Am I correct? 

C:\MyPackage\
            \__init__.py
            \justPrintHelloWorld.py
            \multiply5By10.py

Would I expect the following behavior?:

>>>import MyPackage
>>>MyPackage.justPrintHelloWorld
"Hello World"
>>>MyPackage.multiply5by10
50






More information about the Python-list mailing list