On Mon, 16 May 2005 11:07:06 -0600, Steven Bethard <[EMAIL PROTECTED]> wrote:
> >I must be missing something, because the simplest possible thing seems >to work for me: > >py> import numarray as na >py> def plus1(arr): >... return arr + 1 >... >py> def apply_func(arr, f): >... return f(arr) >... >py> a = na.arange(20, shape=(4, 5)) >py> a >array([[ 0, 1, 2, 3, 4], > [ 5, 6, 7, 8, 9], > [10, 11, 12, 13, 14], > [15, 16, 17, 18, 19]]) >py> apply_func(a, plus1) >array([[ 1, 2, 3, 4, 5], > [ 6, 7, 8, 9, 10], > [11, 12, 13, 14, 15], > [16, 17, 18, 19, 20]]) > >Is this not what you wanted? The problem is that I chose an example function that's too simple. Non-trivial functions aren't so polymorphic, unfortunately. Sorry for the confusion. Matt Feinstein -- There is no virtue in believing something that can be proved to be true. -- http://mail.python.org/mailman/listinfo/python-list