Imports in python are static, any solution?

Luis Alberto Zarrabeitia Gomez kyrie at
Mon Apr 13 18:10:45 CEST 2009

Quoting Ravi <ra.ravi.rav at>:

> This is problematic. Well I want i to change with .

You can't. i and foo.i are _different_ variables that just happen to share the
same value initially. What you are observing is no different than

i = 10
j = i
i = 99

print i  # prints 99
print j  # print 10

May I ask, why is it problematic? You should be avoiding the use of global
variables anyway.

Luis Zarrabeitia
Facultad de Matemática y Computación, UH

Participe en Universidad 2010, del 8 al 12 de febrero de 2010
La Habana, Cuba

More information about the Python-list mailing list