TG wrote: > okay, > > so only when I have inside __init__.py > > __all__ = ["core"] > > this works > > ?> from tom import * > ?> help(core) > > but (in a brand new interpretor) > > ?> import tom > ?> help(tom.core) > > AttributeError: 'module' object has no attribute 'core' > > got it. But ... > > ?> import numpy > ?> help(numpy.core) > > this will work, even if core is a subpackage of numpy. and i don't have > to explicitly import numpy.core. > > I must be missing something ... :-/
numpy does the equivalent of import core in its __init__.py """ Help on method __call__ in module numpy._import_tools: __call__(self, *packages, **options) unbound numpy._import_tools.PackageLoader method Load one or more packages into parent package top-level namespace. Usage: This function is intended to shorten the need to import many of subpackages, say of scipy, constantly with statements such as import scipy.linalg, scipy.fftpack, scipy.etc... Instead, you can say: import scipy scipy.pkgload('linalg','fftpack',...) """ Peter -- http://mail.python.org/mailman/listinfo/python-list