![](https://secure.gravatar.com/avatar/764323a14e554c97ab74177e0bce51d4.jpg?s=120&d=mm&r=g)
12 Jul
2012
12 Jul
'12
1:49 p.m.
On Thu, Jul 12, 2012 at 9:46 PM, Chao YUE <chaoyuejoy@gmail.com> wrote:
Hi Ben,
it helps a lot. I am nearly finishing a function in a way I think pythonic. Just one more question, I have:
In [24]: b=np.arange(1,11)
In [25]: b Out[25]: array([ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
In [26]: b[slice(1)] Out[26]: array([1])
In [27]: b[slice(4)] Out[27]: array([1, 2, 3, 4])
In [28]: b[slice(None,4)] Out[28]: array([1, 2, 3, 4])
so slice(4) is actually slice(None,4), how can I exactly want retrieve a[4] using slice object?
You don't. You use 4. -- Robert Kern