Re: set variable to looping index?

2009-07-30 Thread Bearophile
Martin: for f in var1_fn, var2_fn, var3_fn:     if f.split('.')[0] == 'var1':         var1 = call_some_function(f)         .         .         .       etc As usual I have big problems in understanding what you want to do. Please, show an example of the contents of var1_fn, var2_fn, etc.

set variable to looping index?

2009-07-29 Thread Martin
Hi, I am trying to set the return value from a function to a name which I grab from the for loop. I can't work out how I can do this without using an if statement... for f in var1_fn, var2_fn, var3_fn: if f.split('.')[0] == 'var1': var1 = call_some_function(f) . .

Re: set variable to looping index?

2009-07-29 Thread Peter Otten
Martin wrote: I am trying to set the return value from a function to a name which I grab from the for loop. I can't work out how I can do this without using an if statement... for f in var1_fn, var2_fn, var3_fn: if f.split('.')[0] == 'var1': var1 = call_some_function(f) .

Re: set variable to looping index?

2009-07-29 Thread Dave Angel
Martin wrote: Hi, I am trying to set the return value from a function to a name which I grab from the for loop. I can't work out how I can do this without using an if statement... for f in var1_fn, var2_fn, var3_fn: if f.split('.')[0] == 'var1': var1 = call_some_function(f)

Re: set variable to looping index?

2009-07-29 Thread Rhodri James
On Wed, 29 Jul 2009 19:56:28 +0100, Martin mdeka...@gmail.com wrote: Hi, I am trying to set the return value from a function to a name which I grab from the for loop. I can't work out how I can do this without using an if statement... for f in var1_fn, var2_fn, var3_fn: if f.split('.')[0]

Re: set variable to looping index?

2009-07-29 Thread Martin
On Jul 29, 11:02 pm, Rhodri James rho...@wildebst.demon.co.uk wrote: On Wed, 29 Jul 2009 19:56:28 +0100, Martin mdeka...@gmail.com wrote: Hi, I am trying to set the return value from a function to a name which I grab from the for loop. I can't work out how I can do this without using an

Re: set variable to looping index?

2009-07-29 Thread Jan Kaliszewski
30-07-2009 mdeka...@gmail.com wrote: All I was trying to do was call a function and return the result to an a variable. I could admittedly of just done... var1 = some_function(var1_fn) var2 = some_function(var2_fn) var3 = some_function(var3_fn) where var1_fn, var2_fn, var3_fn are just

Re: set variable to looping index?

2009-07-29 Thread Jan Kaliszewski
Me wrote: filenames = p'foo', 'bar', baz'] Sorry, should be of course: filenames = ['foo', 'bar', baz'] *j -- Jan Kaliszewski (zuo) z...@chopin.edu.pl -- http://mail.python.org/mailman/listinfo/python-list

Re: set variable to looping index?

2009-07-29 Thread Martin
On Jul 29, 11:57 pm, Jan Kaliszewski z...@chopin.edu.pl wrote: 30-07-2009 mdeka...@gmail.com wrote: All I was trying to do was call a function and return the result to an a variable. I could admittedly of just done... var1 = some_function(var1_fn) var2 = some_function(var2_fn) var3 =