[Numpy-discussion] Naming a slice index?

Timothy Hochberg tim.hochberg@ieee....
Mon Oct 1 11:35:28 CDT 2007


On 10/1/07, Eagle Jones <eagle@newdream.net> wrote:
>
> New to python and numpy; hopefully I'm missing something obvious. I'd
> like to be able to slice an array with a name. For example:
>
> _T = 6:10
> _R = 10:15
> A = identity(20)
> foo = A[_T, _R]
>
> This doesn't work. Nor does _T=range(6:10); _R = range(10:15). Any ideas?


Try slice(10,15)


Thanks,
> Eagle
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion@scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion
>



-- 
.  __
.   |-\
.
.  tim.hochberg@ieee.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20071001/51e9ca9c/attachment.html 


More information about the Numpy-discussion mailing list