A 10:40:3 expression only works inside of a [], e.g.
x[10:40:3]
where x is a list or array.
The Python interpreter translates that into:
x.__getitem__(slice(10,40,3))
It would be possible to convert a '10:40:3' string into a slice(10,40,3) object, but you could also accept three integers and build the slice from that.
A slice can be used as:
idx = slice(10,40,3)
x[idx]
In [683]: idx = slice(1,10,2)
In [684]: np.arange(20)[idx]
Out[684]: array([1, 3, 5, 7, 9])
In [685]: np.arange(1,10,2)
Out[685]: array([1, 3, 5, 7, 9])
simple way of making a slice from the string:
In [687]: slice(*[int(i) for i in astr.split(':')])
Out[687]: slice(1, 10, 2)
numpy has also defined some special object that can help with slices, but none work with strings
In [690]: np.r_[idx]
Out[690]: array([1, 3, 5, 7, 9])
In [691]: np.s_[1:10:2]
Out[691]: slice(1, 10, 2)
In [693]: np.s_[1::2]
Out[693]: slice(1, None, 2)
In [694]: np.s_[:]
Out[694]: slice(None, None, None)