Newbie question about import

Luca lucafbb at gmail.com
Sun Apr 27 06:39:32 EDT 2008


On Sat, Apr 26, 2008 at 4:14 AM, Gabriel Genellina
<gagsl-py2 at yahoo.com.ar> wrote:
>  The short answer is: don't do that! __init__.py may import any module, but
> other modules in the package should not import anything from __init__.py
>  The same rule applies to the main module in an application: it can import
> any other required module, but no one should import main.
>  If you don't follow those rules you may encounter some surprises.
>  You *can* break the rules and actually do what you want, but I would not
> reccomend it.
>  In this case, can't you switch the place where __version__ is defined? It
> looks like a constant, so you could have it actually defined in mommy.py,
> and inside __init__.py just import the value.
>

Ok, thanks all for helping.

-- 
-- luca



More information about the Python-list mailing list