NameError in cross imports of modules

Pearu Peterson pearu at cens.ioc.ee
Sat Feb 3 16:14:49 EST 2001


On Sat, 3 Feb 2001, Fredrik Lundh wrote:

> Pearu Peterson wrote:
> > Note: I am not interested in converting the 'from-import' statements to
> > 'import' statements,
> 
> > This behavior is well-known and has, roughly speaking, the following
> > explanation:
> > >>> from A import *    --- imports also module B but only "partly": module
> >                            A is not imported to module B.
> > >>> from B import *    --- nothing is done because module B is already in
> >                            sys.modules.
> > >>> reload(sys.modules['B'])  --- is needed in order to fix the
> >                            NameError: module B will be imported
> >                            "completely".
> 
> if you don't understand how things work today, are you
> really the right person to suggest changes?

Probably not. I don't even understand what you are referring to when
asking such a question. Shouldn't I use 'from-import' statements? Is my
**rough** explanation completely wrong and misunderstood? (Sure, I didn't
bother to  check out that I was using proper terminology, my apologies for
that) Or what?

a-python-user-who-tends-to-abuse-it-because-of-lack-of-style'ly
Pearu




More information about the Python-list mailing list