access to submodules

TG girodt at gmail.com
Wed Jul 19 11:39:33 EDT 2006


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 ... :-/




More information about the Python-list mailing list