On 12 November 2016 at 10:26, Steven D'Aprano <steve@pearwood.info> wrote:
But let's make str() of a slice more suggestive of actual slicing, and
as a bonus, make slices easier to create too.

    str(slice(None, None, None)) => "slice[:]"

Let the slice type itself be sliceable, as an alternate constuctor:

    slice[:]            => returns slice(None)
    slice[start:]       => returns slice(start, None)
    slice[:end]         => returns slice(None, end)
    slice[start::step]  => returns slice(start, None, step)

and so forth. (This probably would require changing the type of slice to
a new metaclass.)

And then have str() return the compact slice syntax.

+1, I like this idea, this is very close to what NumPy does.
I would also mention http://bugs.python.org/issue24379