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

Chris Angelico rosuav at gmail.com
Wed Nov 16 21:26:18 EST 2016


On Thu, Nov 17, 2016 at 1:01 PM,  <jfong at ms4.hinet.net> wrote:
> Michael Torrie at 2016/11/16 11:15:11AM wrote:
>> ... The globals object is a dictionary and is itself
>> mutable.  But when we assign a new object to a particular dictionary
>> key, it tosses out the old reference and makes the key now refer to the
>> new object.  It does not do anything to the old object itself.
>
> The last question: Is it possible, in the current Python version, to re-bind a global name in module "deen" after it was imported "from deen import *"?

Yes.

from deen import *

...

import deen
deen.some_name = new_value

Voila :)

ChrisA



More information about the Python-list mailing list