[Numpy-discussion] IndexExpression bug?

2009-06-05 Thread Michael McNeil Forbes
>>> np.array([0,1,2,3])[1:-1] array([1, 2]) but >>> np.array([0,1,2,3])[np.s_[1:-1]] array([1, 2, 3]) >>> np.array([0,1,2,3])[np.index_exp[1:-1]] array([1, 2, 3]) Possible fix: class IndexExpression(object): ... def __len__(self): return 0 (Presently this returns sys.maxin

Re: [Numpy-discussion] IndexExpression bug?

2009-06-05 Thread Robert Kern
On Fri, Jun 5, 2009 at 16:14, Michael McNeil Forbes wrote: >  >>> np.array([0,1,2,3])[1:-1] > array([1, 2]) > > but > >  >>> np.array([0,1,2,3])[np.s_[1:-1]] > array([1, 2, 3]) >  >>> np.array([0,1,2,3])[np.index_exp[1:-1]] > array([1, 2, 3]) > > Possible fix: > class IndexExpression(object): >  

Re: [Numpy-discussion] IndexExpression bug?

2009-08-17 Thread Michael McNeil Forbes
Submitted as ticket 1196 http://projects.scipy.org/numpy/ticket/1196 On 5 Jun 2009, at 4:12 PM, Robert Kern wrote: > On Fri, Jun 5, 2009 at 16:14, Michael McNeil Forbes > wrote: >> >>> np.array([0,1,2,3])[1:-1] >> array([1, 2]) >> >> but >> >> >>> np.array([0,1,2,3])[np.s_[1:-1]] >> array([1,