[Zope3-dev] Importing

Guido van Rossum guido@python.org
Thu, 13 Dec 2001 22:55:53 -0500


> > I'm afraid that you mean that
> > /package1 is on sys.path?  That's evil!
> 
> Urm, don't understand why ti's evil, can you explain?
> I thougth beign on sys.path was the onyl way a package could be imported?

No, I meant the situation where both

    "/" in sys.path

and

    "/package1" in sys.path

are true.  (You can substitute something else for "/". :-)

Tis is really evil, because when you write

    import package1.package2.moduleX
    import package2.moduleX

two independent copies of moduleX are loaded, that don't share state.

--Guido van Rossum (home page: http://www.python.org/~guido/)