Re: [Tutor] a code question, but don't know question's name

2007-10-07 Thread Happy Deer
I am writing a function getdata for other people, and I want others can use the function as follows. var1,var2, var3=getdata(..., ['var1','var2','var3'],...) If I can not return data column by column, I can not get the above, right? On 10/7/07, Eric Brunson <[E

[Tutor] corresponding command in Python to "eval" in Matlab

2007-10-07 Thread Happy Deer
Dear all- I wonder whether there is a way in Python which can do what "eval" in Matlab does. Say, varlist is a 1 by k tuple/list, which contains strings for variable names. For example, varlist=['var1','var2',...'vark'] data is a n by k matrix. I want to assign each column in data to each variabl

Re: [Tutor] a code question, but don't know question's name

2007-10-07 Thread Happy Deer
Thank all for the discussion. Maybe I can separate my question into two. First, I have experience in Matlab, where I can use "eval". I wonder whether someone knows about it. Second, if I just want to return data[:,1], ...data[:,-1] separately without knowing ahead how many columns data has. What

[Tutor] a code question, but don't know question's name

2007-10-06 Thread Happy Deer
Dear all- I am writing a function as follows. def getdata(varlist): eventually I have a variable called "data", which have exactly the same number of columns as the name of variables in varlist. Say varlist=['var1','var2','var3']. I want to assign var1=data[:,0], var2=data[:,1], var3=data[