Question about functions

Ahmed MOHAMED ALI ahmedmo at wanadoo.fr
Fri Dec 26 09:35:49 EST 2003


Hi,
don't use the form  "from  A  import"
instead use the form " import A" and then use  A.Product to modify the
"Product"  variable.
Ahmed

"Aubrey Hutchison" <abhjrpe at comcast.net> wrote in message
news:I_2dnalUksLsg3GiRVn-uA at comcast.com...
> 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