[Numpy-discussion] why does b[:-0] not work, and is there an elegant solution?
Sebastian Walter
sebastian.walter@gmail....
Wed Aug 19 08:03:38 CDT 2009
In [45]: x[: -0 or None]
Out[45]: array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
In [46]: x[: -1 or None]
Out[46]: array([0, 1, 2, 3, 4, 5, 6, 7, 8])
works fine without slice()
On Wed, Aug 19, 2009 at 2:54 PM, Citi, Luca<lciti@essex.ac.uk> wrote:
> Another solution (elegant?? readable??) :
>>> x[slice(-n or None)] # with n == 0, 1, ...
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
More information about the NumPy-Discussion
mailing list