>> If I can figure out how to make my main function subroutine declare 
>> global
>> variables then I won't need to pass parameters most parameters to 
>> the other
>> subroutines,

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...

>> and will bypass the problem I'm having that sometimes the function
> strongfac SOMETIMES does not return the value it has in the 
> subroutine,
> back to the calling routine.

I'm not sure how you work that out. If the function uis getting bad 
data
it will still return it regardless of whether you use golobals or 
return values.

> Yes.   How can I make a package of functions declare global 
> variables for
> passing information between the functions in the package?

just use the global keyword:

###############
x,y = 42,27

def f():
   global x,y
   x = 66
   y = 42
   print x+y

print x,y
f()
print x,y
############

But its very bad practice and

##############
x,y = 42,27
def f(x,y):
    x = 66
    y = 42
    print x+y
    return x,y

print x,y
x,y = f(x,y)
print x,y
##########

is much better.

Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld 

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to