On 11/14/2016 11:32 PM, jf...@ms4.hinet.net wrote: > 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:-(
Seems like you're still not understanding Python variables. After importing all the names from "deen" into your current module's namespace, they do "point" or refer to the actual objects from the deen module. So at that moment, they are the same objects as if you were to import deen and refer to them with the deen.foo notation. However once you assign to these names in your current module you are breaking this link to the deen module and assigning a new object to these names in your current module's namespace. You're getting hung up on the names, when you should be concentrating on what the names refer to. Variables in python aren't implement the same as C, or Java. They aren't aliases for a box in memory that you can alter using assignment. Instead assignment points the name to the object in the RHS, in place of the old object it used to refer to (if the references to this old object reach zero, it is deleted). As you've been told several times, if you "import deen" then you can place a new object into the deen namespace using something like: deen.foo=bar Importing everything from an imported module into the current module's namespace is not the best idea. -- https://mail.python.org/mailman/listinfo/python-list