[Zope3-dev] Importing

Chris Withers chrisw@nipltd.com
Fri, 14 Dec 2001 12:43:34 +0000


Guido van Rossum wrote:
> 
> > > 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.

Indeed, that would be evil, thankfully not what I was talking about :-)

cheers,

Chris