Thanks Alan and Kent ...Its much clearer now.
Any tutorial/reference you recommend to read about python modules?
Thanks
G
On Mon, Jun 16, 2008 at 5:08 PM, Kent Johnson <[EMAIL PROTECTED]> wrote:
> On Mon, Jun 16, 2008 at 4:38 PM, Guess?!? <[EMAIL PROTECTED]> wrote:
>
> > Also once we reload the
On Mon, Jun 16, 2008 at 4:38 PM, Guess?!? <[EMAIL PROTECTED]> wrote:
> Also once we reload the module every value reverts to its original
> value .. Am I Right?
Yes, but maybe not in the way you think. A new copy of the module will
be loaded and bound to the name 'eli'. But the names x, y an
"Guess?!?" <[EMAIL PROTECTED]> wrote
*Module Name eli.py*
x = 0
y = [1, 2]
def whitney():
print 'whitney'
def printValues():
print x , y
*When I imported the Module*
from eli import x, y, printValues
Note that by doing this you are not really importing the module
but the names fr
*Module Name eli.py*
x = 0
y = [1, 2]
print 'Running module "eli"'
def whitney():
print 'whitney'
def printValues():
print x , y
*When I imported the Module*
from eli import x, y, printValues
printValues()
y[0] = 'cat'
x = 'dog'
printValues()
Output
Running module "eli"
0 [1, 2]
0 [