[SciPy-user] slice question
Wed Feb 11 17:40:05 CST 2009
Thanks maestro ! (not quite as trivial as I thought it would be)
> On Wed, Feb 11, 2009 at 17:31, Karl Young <firstname.lastname@example.org> wrote:
>> Sorry for the dumb question but I did search quite a bit before
>> realizing it would only take a couple of keystrokes from an Illuminati
>> to dispel my ignorance.
>> I want to slice an array as:
>> starting with two 1d arrays containing the lower and upper slice limits:
>> B = [a,c,e,...] and C = [b,d,f,...]
>> and I'd like to write a general expression for this given A,B,C (i.e.
>> not specify the dimension) but I can't figure out how to turn B and C
>> into a:b,c:d,e:f,... re indexing A - any thoughts ? Thanks
> A[tuple([slice(b,c) for b,c in zip(B,C)])]
More information about the SciPy-user