[Tutor] Global variables
kermit at polaris.net
Tue Aug 15 00:51:43 CEST 2006
From: Luke Paireepinart
Date: 08/14/06 17:17:13
To: Kermit Rose
Cc: Danny Yoo; tutor at python.org
Subject: Re: [Tutor] Global variables
> From: Luke Paireepinart
> are you asking a question?
> Kermit Rose wrote:
> Yes. How can I make a package of functions declare global variables for
> passing information between
> the functions in the package?
a 'package' meaning a module?
Yes. I mean a module.
If you think you need global variables you're probably going about the
problem the wrong way.
What are you trying to do?
In my module I have several functions which work together to factor integers
One function, called testrange is the main calling routine.
It generates Tables and and passes their values to the main factoring
Fermat calls a routine named strongfac.
There seems to be some type of bug in Python because
I observe that
strongfac, depending on the number being factored,
will sometimes return 0 instead of the factors it found.
I believe that if I can get my main function, testrange,
to declare a global variable to hold the caculated factor list,
then I can bypass the apparent bug in Python that actualizes only
for a few particular numbers to be factored.
Also, if I can get testrange to create global variables, then I can shorten
the parameter list of many of the
functions in the module.
Kermit < kermit at polaris.net >
More information about the Tutor