Re: Array of Functions

2015-05-26 Thread Gary Herron
On 05/26/2015 05:43 PM, richard_riehle wrote: I realized that I mentioned earlier that I found a solution to my original question, but that I never posted an example of the solution. So, here is a simplified example for anyone who is interested. def fArray(fselect, fparm = 1): def A

Re: Array of Functions

2015-05-26 Thread Laura Creighton
In a message of Tue, 26 May 2015 19:43:31 -0500, richard_riehle writes: >I realized that I mentioned earlier that I found a solution to my original >question, but that I never posted an example of the solution. So, here is a >simplified example for anyone who is interested. > >def fArray(fselec

Re: Array of Functions

2015-05-26 Thread richard_riehle
I realized that I mentioned earlier that I found a solution to my original question, but that I never posted an example of the solution. So, here is a simplified example for anyone who is interested. def fArray(fselect, fparm = 1): def A1(p = fparm): if p == 1:

Re: Array of Functions

2014-11-17 Thread Anton
On Friday, November 14, 2014 2:17:38 PM UTC-8, Richard Riehle wrote: > In C, C++, Ada, and functional languages, I can create an array of functions, > albeit with the nastiness of pointers in the C family. For example, an > array of functions where each function is an active button, or an array

Re: Array of Functions

2014-11-16 Thread Richard Riehle
On Friday, November 14, 2014 4:13:28 PM UTC-8, Dennis Lee Bieber wrote: > On Fri, 14 Nov 2014 14:17:23 -0800 (PST), Richard Riehle > declaimed the following: > > >In C, C++, Ada, and functional languages, I can create an array of > >functions, albeit with the nastiness of pointers in the C famil

Re: Array of Functions

2014-11-14 Thread Terry Reedy
On 11/14/2014 5:17 PM, Richard Riehle wrote: In C, C++, Ada, and functional languages, I can create an array of functions, albeit with the nastiness of pointers in the C family. For example, an array of functions where each function is an active button, or an array of functions that behave like f

Re: Array of Functions

2014-11-14 Thread MRAB
On 2014-11-14 22:17, Richard Riehle wrote: In C, C++, Ada, and functional languages, I can create an array of functions, albeit with the nastiness of pointers in the C family. For example, an array of functions where each function is an active button, or an array of functions that behave like for

Re: Array of Functions

2014-11-14 Thread Ian Kelly
On Fri, Nov 14, 2014 at 3:17 PM, Richard Riehle wrote: > In C, C++, Ada, and functional languages, I can create an array of functions, > albeit with the nastiness of pointers in the C family. For example, an > array of functions where each function is an active button, or an array of > functi

Re: Array of Functions

2014-11-14 Thread Sam Raker
I second the call for a more concrete implementation, but if you want the results of the functions in c3 to be responsive to the values of c1 and c2 (i.e., if you change r1c1, r1c3 returns a different value), it might be worth encapsulating the whole thing in an object and making the c3 function

Re: Array of Functions

2014-11-14 Thread Marko Rauhamaa
Richard Riehle : > Example: > > r1c1 r1c2 r1c3 > r2c1 r2c2 r2c3 > r3c1 r3c2 r3c3 > > where r1 is row 1 and c1 is column 1. Suppose I want an array where the > colum three is a set of functions that operates on the other two > columns, depending on the v

Re: Array of functions, Pythonically

2008-02-25 Thread Paul McGuire
On Feb 25, 11:53 am, [EMAIL PROTECTED] wrote: > >  { '+': operator.add, '-': operator.sub, ... } > > Then EXPR OPER EXPR -> ops[ OPER ]( EXPR, EXPR ), right? I think this is the most Pythonic idiom. You can even define your own custom binary operators, such as '$' to convert dollars and cents to

Re: Array of functions, Pythonically

2008-02-25 Thread castironpi
>  { '+': operator.add, '-': operator.sub, ... } Then EXPR OPER EXPR -> ops[ OPER ]( EXPR, EXPR ), right? -- http://mail.python.org/mailman/listinfo/python-list

Re: Array of functions, Pythonically

2008-02-25 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > My parser has found an expression of the form CONSTANT_INTEGER > OPERATOR CONSTANT_INTEGER. I want to fold this into a single > CONSTANT_INTEGER. > > The OPERATOR token has an intValue attribute, '+' == 0, '-'== 1, etc. > In C I'd put functions Add, Subtract, ... into

Re: Array of functions, Pythonically

2008-02-25 Thread Duncan Booth
[EMAIL PROTECTED] wrote: > My parser has found an expression of the form CONSTANT_INTEGER > OPERATOR CONSTANT_INTEGER. I want to fold this into a single > CONSTANT_INTEGER. > > The OPERATOR token has an intValue attribute, '+' == 0, '-'== 1, etc. > In C I'd put functions Add, Subtract, ... into a