[Tutor] Little problem with math module

tiger12506 keridee at jayco.net
Wed Apr 23 05:38:48 CEST 2008

Hmm. I didn't read particularly closely, but it seemed that there were two 
different versions going on. The first examples more like what he wanted to 
happen, and the last example what he tried and didn't get to work. Since 
it's in a different module he can get around it by using global erro and 
then using modulename.erro when he uses the actual value.

----- Original Message ----- 
From: "Kent Johnson" <kent37 at tds.net>
Cc: <tutor at python.org>
Sent: Monday, April 21, 2008 9:33 PM
Subject: Re: [Tutor] Little problem with math module

> tiger12506 wrote:
>>> my problem is, INSIDE the funcion...the variable erro is correct, but
>>> when i return it to the test...and the test prints it....comes out 0.0.
>>> Its disturbing...i didnt found a way of solving this.
>> err is defined in the function so it thinks it's a local variable.
> My reading is that erro is returned from the function and assigned to a 
> 'new' erro at the point of call.
>  You
>> can set it to change only the global variable by putting
>> global err
>> as the line right after your function def.
> No, because the caller is in a different module.
> Kent
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor

More information about the Tutor mailing list