[Numpy-discussion] Naming a slice index?

Timothy Hochberg tim.hochberg at ieee.org
Mon Oct 1 12:35:28 EDT 2007


On 10/1/07, Eagle Jones <eagle at 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 at scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion
>



-- 
.  __
.   |-\
.
.  tim.hochberg at ieee.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20071001/51e9ca9c/attachment.html>


More information about the NumPy-Discussion mailing list