Policy for import of submodules

Juan Nunez-Iglesias jni.soma at gmail.com
Tue Jan 29 23:05:41 EST 2013


Hi,

Does scikit-image have a specific policy for how imports should work? For
example, as far as I know, numpy currently imports everything into the np
namespace with:

import numpy as np


However, the following raises an error, even though the import statement
works fine:

import skimage as skim
coins = skim.data.coins()

giving the error:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-3-0ce27ef61295> in <module>()
----> 1 coins = skim.data.coins()

AttributeError: 'module' object has no attribute 'data'


But some things *are* in the top-level namespace. The following works fine:

import skimage as skimfrom skimage import data
coins = data.coins()
coins = skim.img_as_float(coins)


So my question is, is this behaviour by design, or should there be nothing
at all in the top-level, or should everything be imported?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scikit-image/attachments/20130130/309dae9c/attachment.html>


More information about the scikit-image mailing list