import package w/ all subpackages?

Your Mom yourmom at hotmail.com
Sat Mar 29 20:56:27 EST 2003


    There doesn't seem to be a built-in way to import a package w/ all it's
subpackages & modules.  Does anyone else see value in adding a statement
like "import fully foolib"?

    I've developed a package that (in trying to keep its contents organized
properly) has ended up with a number of modules & subpackages.  Currently, a
typical program attempting to use my package needs to run 'import
foolib.foo, foolib.bar, foolib.baz' for each component to be used.  I've
determined that i *could* make things easier by adding 'import foo, bar,
baz' in the __init__.py file; however, this forces all programs using a
single component from the package to import them all, requiring that any
depency of any of those components be installed.  Wouldn't it be nice to for
scripts that want everything in a package to be available for use to say
something along the lines of "import fully foolib", while letting other
scripts pick modules ala cart?  Just a thought, anyway...

   - Michael






More information about the Python-list mailing list