[Numpy-discussion] use slicing as argument values?

Daniele Nicolodi daniele at grinta.net
Fri Jul 13 06:58:22 EDT 2012


On 12/07/2012 23:32, Chao YUE wrote:
> Thanks all for the discussion. Actually I am trying to use something
> like numpy ndarray indexing in the function. Like when I call:
>
> func(a,'1:3,:,2:4'), it knows I want to retrieve a[1:3,:,2:4], and
> func(a,'1:3,:,4') for a[1:3,:,4] ect.
> I am very close now.

I don't see the advantage of this approach over directly using the 
sliced array as an argument of your function, as in func(a[1:3,:,4]).

Can you elaborate more why you are going through this route?

Cheers,
Daniele



More information about the NumPy-Discussion mailing list