On Oct 29, 2013, at 15:07, Nick Coghlan <ncoghlan@gmail.com> wrote:

Isn't all that is needed to prevent the default wraparound behaviour clamping negative numbers to zero on input?

As in:

def clampleft(start, stop, step):
    if start is not None and start < 0:
        start = 0
    if stop is not None and stop < 0:
        stop = 0
    return slice(start, stop, step)

Except many of the wraparound cases people complain about are the other way around, negative stop wrapping around to 0. 

You could fix that almost as easily:

def clampright(start, stop, step):
    if start >= 0:
        start = ???
    if stop >= 0:
        stop = None
    return slice(start, stop, step)

Except... What do you set start to if you want to make sure it's past-end? You could force an empty slice (which is the main thing you want) with, e.g., stop=start=0; is that close enough?