imported var not being updated

John Posner jjposner at optimum.net
Tue Mar 9 09:18:42 EST 2010


On 3/8/2010 11:55 PM, Gary Herron wrote:
<snip>
>
> The form of import you are using
> from helpers import mostRecent
> makes a *new* binding to the value in the module that's doing the
> import.

<snip>

> What you can do, is not make a separate binding, but reach into the
> helpers module to get the value there. Like this:
>
> import helpers
> print helpers.mostRecent
>

Gary, are you asserting that in these separate situations:

one.py:

   from helpers import mostRecent
   x = mostRecent

two.py:

   import helpers
   x = helpers.mostRecent


... the name "x" will be bound to different objects?

Tx,
John



More information about the Python-list mailing list