Better slicing and indexing for `__getitem__` (#454)
Better slicing and indexing for `__getitem__` (#454)

* Better slicing and indexing for `__getitem__`

Python's `slice()` class has a very convenient
method of `indices(len)` which safely converts
a `slice` to a tuple of safe `(start, stop, step)`.

This PR replced the handcrafted (and error prune)
slicing management with native `indices()` method.

Signed-off-by: Yong Tang <765086fe2e0c1f980161f127fec596800f327f62@outlook.com>

* Also makes sure that when stop - start == 1 the shape is squeezed to one less dimension

Signed-off-by: Yong Tang <765086fe2e0c1f980161f127fec596800f327f62@outlook.com>

* Combine multiple calls based on review feedback

Signed-off-by: Yong Tang <765086fe2e0c1f980161f127fec596800f327f62@outlook.com>

tensorflow/io,tensorflow/io,tensorflow/io,tensorflow/io,tensorflow/io,tensorflow/io,tensorflow/io