seeking the "Hello World" of Packages

faulkner faulkner612 at comcast.net
Fri Aug 11 13:53:24 EDT 2006


yep, that's all a package is.
if you have trouble importing, check your PYTHONPATH environment
variable, or sys.path.

Bell, Kevin wrote:
> 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