Pass a list of variables to a procedure

KRB alagalah at gmail.com
Sat Apr 7 17:15:09 EDT 2012


Hi there,

I would like to be able to pass a list of variables to a procedure, and have the output assigned to them.

For instance:

x=0
y=0
z=0

vars =[x,y,z]
parameters=[1,2,3]

for i in range(1,len(vars)):
*** somefunction that takes the parameter "1", does a computation and assigns the output to "x", and so on and so forth.

Such that later in the program I can
print x,y,z 

I hope that makes sense, otherwise I have to do:
x=somefunction(1)
y=somefunction(2)
z=somefunction(3)
etc etc

Appreciate any help



More information about the Python-list mailing list