Re: [Tutor] Iterating over list of functions

2009-05-20 Thread Dave Angel
Robert Berman wrote: Thank you, Christian. This solution was one I was not expecting and am glad to receive it. It is one I will explore in greater detail later. Robert On Wed, 2009-05-20 at 16:44 +0200, Christian Witts wrote: Robert Berman wrote: Hi, Given a list of options: optio

Re: [Tutor] Iterating over list of functions

2009-05-20 Thread ALAN GAULD
> understand exactly what you are saying and what you are advocating. > The 'dictionary of functions' is the 'best' approach because of simplicity > and because it minimizes chances or errors. Correct. Maintaining synch of indexes between two arrays of data items is always going to be a risky b

Re: [Tutor] Iterating over list of functions

2009-05-20 Thread spir
Le Wed, 20 May 2009 10:25:21 -0400, Robert Berman s'exprima ainsi: > What I do not know how to do is to call the selected function. If you have options and functions "hard-coded" in lists (or if you get them from outside), you can still let python build a dict for you, using "zip": l1 = [1,2,3

Re: [Tutor] Iterating over list of functions

2009-05-20 Thread Robert Berman
Alan, The emphasis of your reply certainly makes me look at the dictionary solution as the most 'correct' solution to utilize. Before I change the code I just implemented, let me make sure I understand exactly what you are saying and what you are advocating. The 'dictionary of functions' is the 'b

Re: [Tutor] Iterating over list of functions

2009-05-20 Thread Alan Gauld
"Robert Berman" wrote Thank you, Christian. This solution was one I was not expecting and am glad to receive it. It is one I will explore in greater detail later. A dictionary of functions is the most common way to tackle this fairly common requirement. It combines readability with ease of

Re: [Tutor] Iterating over list of functions

2009-05-20 Thread Robert Berman
Thank you, Christian. This solution was one I was not expecting and am glad to receive it. It is one I will explore in greater detail later. Robert On Wed, 2009-05-20 at 16:44 +0200, Christian Witts wrote: > Robert Berman wrote: > > Hi, > > > > Given a list of options: option_1...option_n. F

Re: [Tutor] Iterating over list of functions

2009-05-20 Thread Robert Berman
Thank you, Emile. That is the exact answer I needed. Robert On Wed, 2009-05-20 at 07:48 -0700, Emile van Sebille wrote: > On 5/20/2009 7:25 AM Robert Berman said... > > Hi, > > > > Given a list of options: option_1...option_n. For each option I have > > a corresponding function: func_1...

Re: [Tutor] Iterating over list of functions

2009-05-20 Thread Emile van Sebille
On 5/20/2009 7:25 AM Robert Berman said... Hi, Given a list of options: option_1...option_n. For each option I have a corresponding function: func_1. func_n. I have all function names defined in a list similar to flist = [func_1, func_2,...func_n] which I know is a legitimate constru

Re: [Tutor] Iterating over list of functions

2009-05-20 Thread Christian Witts
Robert Berman wrote: Hi, Given a list of options: option_1...option_n. For each option I have a corresponding function: func_1. func_n. I have all function names defined in a list similar to flist = [func_1, func_2,...func_n] which I know is a legitimate construct having found a simi

Re: [Tutor] Iterating over list of functions

2009-05-20 Thread Lie Ryan
Robert Berman wrote: Hi, Given a list of options: option_1...option_n. For each option I have a corresponding function: func_1. func_n. I have all function names defined in a list similar to flist = [func_1, func_2,...func_n] which I know is a legitimate construct having found a simi

[Tutor] Iterating over list of functions

2009-05-20 Thread Robert Berman
Hi, Given a list of options: option_1...option_n. For each option I have a corresponding function: func_1. func_n. I have all function names defined in a list similar to flist = [func_1, func_2,...func_n] which I know is a legitimate construct having found a similar construct discusse