Is this right? Multiple imports of same module.
Lou Pecora
pecora at anvil.nrl.navy.mil
Sat Mar 10 12:16:19 EST 2007
In article <DThIh.10891$tD2.1731 at newsread1.news.pas.earthlink.net>,
Dennis Lee Bieber <wlfraed at ix.netcom.com> wrote:
>
> Expected behavior if you 1) understand how Python variable binding
> works, and 2) that "from <> import *" is equivalent to
>
> import <>
> name1 = <>.name1
> name2 = <>.name2
>
> IOWs, one is creating local names that are bound to the objects
> inside the imported module. If, subsequently, one does
>
> name2 = 123
>
> one has UNbound the connection to <>.name2 and rebound the local name to
> the integer object 123. Whereas
>
> <>.name2 = 123
>
> says "go into the module <>, and rebind its 'name2' to the integer
> object 123"; since you "went inside" to do the rebinding, any other code
> that also uses the <>.name2 reference will see the change inside <>.
Ah! (light bulb goes on) Yes, I get it. Thanks. No more from **
import *.
-- Lou Pecora (my views are my own) REMOVE THIS to email me.
More information about the Python-list
mailing list