Suppose you have the following numpy array,
>>> x = numpy.array([0,1,2,3,4,5,6,7,8,9,10])
and you want to extract a new numpy array consisting of only the first three (3) and last four (4) elements, i.e.,
>>> y = x[something]
>>> print y
[0 1 2 7 8 9 10]
Is this possible? I know that to extract the first three numbers you simply do x[:3] and to extract the last four you do x[-4:], but is there a simple way of extracting all that in a simple slice? I know this can be done by, e.g., appending both calls,
>>> y = numpy.append(x[:3],x[-4:])
but I was wondering if there is some simple little trick to do it in a more direct, pythonic way, without having to reference x again (i.e., I first thought that maybe x[-4:3] could work but I realized immediately that it didn't made sense).