Question about functions

Aubrey Hutchison abhjrpe at comcast.net
Fri Dec 26 06:43:39 EST 2003


Question about functions:

1)--- module "A" contains the following
 X          = 999666       #easy to notice value
 Y          = 111222       #easy to notice value
 Product = 69696969   #easy to notice value

 def  DoSomething():
      global Product,X,Y
      Product = X*Y
      return 0

 module imported
 from A import *

2)--- toplevel code

 def Mult():
      global Product,X,Y
      DoSomething():
      return 0

 """start of top level code """
 ...
 ...
 Product =Mult()
 ...
 print Product   (      Result   ----> print out is 69696...)

Per "Python Nutshell" this appears to be the correct result.
How do you or can you modify the imported variables without using
classes objects?

Aubrey






More information about the Python-list mailing list