t
those two functions in a list. Then, with appropriate parameters, I called one
of the functions in the list, associated the formal parameter with the function
in a call to the array, and presto, it performs the function.
The more advanced problem I wanted to solve, a two dimensional arr
hose two functions in a list. Then, with appropriate parameters, I
>called one of the functions in the list, associated the formal parameter with
>the function in a call to the array, and presto, it performs the function.
>
>The more advanced problem I wanted to solve, a two dimen
ith the function
in a call to the array, and presto, it performs the function.
The more advanced problem I wanted to solve, a two dimensional array of
functions, once this example is understood, becomes trivial to implement. In
fact, the more interesting problem I wanted to solve invo
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 butt
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
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
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
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
functions
properties, which is Python for 'preprocessed attributes.'
On Friday, November 14, 2014 5:17:38 PM UTC-5, 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 exam
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
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 formulae in a spreadsheet. I am finding
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
> { '+': operator.add, '-': operator.sub, ... }
Then EXPR OPER EXPR -> ops[ OPER ]( EXPR, EXPR ), right?
--
http://mail.python.org/mailman/listinfo/python-list
[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
[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
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 an array and call
ArithmeticFunctions[
On Mon, 19 Feb 2007 05:17:03 -0800, Rob Wolfe wrote:
>> > # test.py
>> >
>> > def fun1(): return "fun1"
>> > def fun2(): return "fun2"
>> > def fun3(): return "fun3"
>> >
>> > # list of functions
>> > dsp = [f for fname, f in sorted(globals().items()) if callable(f)]
>>
>> Hmmm... when I try that,
On Feb 19, 11:47 pm, Steven D'Aprano
<[EMAIL PROTECTED]> wrote:
> On Mon, 19 Feb 2007 00:16:39 -0800, Rob Wolfe wrote:
>
> > Steven W. Orr wrote:
> >> I have a table of integers and each time I look up a value from the table
> >> I want to call a function using the table entry as an index into an a
Steven D'Aprano wrote:
> On Mon, 19 Feb 2007 00:16:39 -0800, Rob Wolfe wrote:
>
> >
> > Steven W. Orr wrote:
> >> I have a table of integers and each time I look up a value from the table
> >> I want to call a function using the table entry as an index into an array
> >> whose values are the diffe
On Mon, 19 Feb 2007 00:16:39 -0800, Rob Wolfe wrote:
>
> Steven W. Orr wrote:
>> I have a table of integers and each time I look up a value from the table
>> I want to call a function using the table entry as an index into an array
>> whose values are the different functions. I haven't seen anyt
thing on how to do this in python.
func_array = [f1, f2, f3]# array of functions
index = table_lookup()
func_array[index](x,y,z) # select a function and call it
--
http://mail.python.org/mailman/listinfo/python-list
Steven W. Orr wrote:
> I have a table of integers and each time I look up a value from the table
> I want to call a function using the table entry as an index into an array
> whose values are the different functions. I haven't seen anything on how
> to do this in python.
Do you mean something li
Steven W. Orr schrieb:
> I have a table of integers and each time I look up a value from the
> table I want to call a function using the table entry as an index into
> an array whose values are the different functions. I haven't seen
> anything on how to do this in python.
def f():
pass
f
I have a table of integers and each time I look up a value from the table
I want to call a function using the table entry as an index into an array
whose values are the different functions. I haven't seen anything on how
to do this in python.
TIA
--
Time flies like the wind. Fruit flies like
24 matches
Mail list logo