I am trying to specify which variables a function should return. The purpose of this is to allow the function to return different sets of variables according to the requirements of another function, in order to make things more efficient (rather than always returning all the variables):
# Python 2.6 def myfunc(arg1, arg2): x = 2 y = 3 z = 4 return arg1 print myfunc('x, y', arg2) #would return: 2, 3 print myfunc('y, z', arg2) #would return: 3, 4
arg2 is another argument separate from the variable list that I am trying to return. Any suggestions?