help on "from deen import *" vs. "import deen"

jfong at ms4.hinet.net jfong at ms4.hinet.net
Tue Nov 15 01:32:54 EST 2016


MRAB at 2016/11/15 11:31:41AM wrote:
> When you say "from deen import *" you're copying names and their 
> references from the module's namespace to your local namespace:
> 
>      [module deen]                                   [locally]
> 
>      tblm ------------> [0, 0, 0] <----------------- tblm
> 
>      tbli ------------> [102, 39, 208] <------------ tbli

hmm...I always thought that the picture of "from deen import *" is

                                [locally]

     [0, 0, 0] <----------------- tblm

     [102, 39, 208] <------------ tbli

But obviously it's not. The compiled code of function gpa is still reference to a hidden deen.tblm 'global' object which I can't access anymore. A bad news:-(

--Jach




More information about the Python-list mailing list