|
From: Travis O. <oli...@ee...> - 2006-02-10 22:17:04
|
Alan G Isaac wrote: >On Fri, 10 Feb 2006, Stefan van der Walt apparently wrote: > > >>In Octave that would be >>[1, 0, 1:4, 0, 1] >>Using numpy we currently do >>concatenate([[1, 0], arange(1,5), [0, 1]]) or >>vstack(...) >> >> > >numpy.r_[1,0,range(1,5),0,1] > > or even faster numpy.r_[1,0,1:5,0,1] The whole point of r_ is to allow you to use slice notation to build ranges easily. I wrote it precisely to make it easier to construct arrays in a simliar style that Matlab allows. -Travis |