From: Alan Gauld Date: 08/14/06 18:42:41 To: Kermit Rose; Luke Paireepinart Cc: tutor@python.org; Danny Yoo Subject: Re: [Tutor] Global variables That may be true but you will make your code much less reusable and much more error propne in the process. There are good reasons why global variables are considered evil... ***** I know that global variable usage can be abused. But in fact I use the same variable names in the subroutine parameter list as in the calling routine for every function in the module. So I believe that in this case global variables would be useful and not likely to increase errors due to confusion of global and local variables. I would never have a local variable with the same name as the global variable. But in this case, it's only because of an apparent bug in Python that want to bypass that I'm considering the use of global variables. My routine strongfac calculates a value for fac in the subroutine, and the calling routine picks up a different vaalue. An illustration. In strong fac: fac = [1,2,3] print fac return fac in fermat: fac = strongfac(z) print fac prints [0,0,0] And most of the time it does not misbehave like this. It is only occasionally, and consistently with certain numbers to be factored. Kermit < [EMAIL PROTECTED] >
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor