[Tutor] Question about global variables on modules

Anthony Baldwin tonytraductor at linguasos.org
Sat Apr 5 05:58:51 CEST 2008


Tiago Katcipis wrote:
> I know its not such a pretty thing to have global variables but its only
> for an exercise my teacher told to do. Its a function to calculate the
> results of a matrix using jacob. I want to inside the module (inside a
> function on the module )assign a value to a global variable, but the
> only way i found to do this inside the own module function is importing
> the module inside himself. Is there another way of doing this? its kind
> odd to import the module to himself, i think  :-) 
>
> here goes the code
>   
Oi, Tiago

Não sei muito bem como funciona em Python,
sendo que já estou começando a aprender-lo, mais,
deve ter algo como o "uplevel" em Tcl, não?
Tcl's uplevel sets a variável pelo namespace global.
Ou talvez algo como
set ::var value (esse funciona em tcl
pra set a variável globalmente mas dentro de um proc)?

/tony

-- 
Anthony Baldwin

http://www.BaldwinLinguas.com 
Translation & Interpreting

http://www.TransProCalc.org 
Free translation project mgmt software 

http://www.LinguasOS.org 
Linux for Translators




More information about the Tutor mailing list