Library package import question
Frank.Aune at broadpark.no
Mon Nov 5 14:34:26 CET 2007
I have a python library package 'Foo', which contains alot of submodules:
To prevent namespace pollution, I want to import and use this library in the
t = Foo.module2.Bee()
To accomplish this, I put explicit imports in __init__.py:
what Im wondering about, is if its a more refined way of doing this, as the
explicit imports now need to be manually maintained if the library grows.
I've tried to use __all__, but this only seems to work with "from Foo import
*" and it causes modules to be imported directly into the namespace of
Thanks for input.
More information about the Python-list