

@classdef.method('[]')
@classdef.method('slice')
def method_subscript(self, space, w_idx, w_count=None):
    (start, end, as_range, nil) = space.subscript_access(self.length(), w_idx, w_count=w_count)
    if nil:
        return space.w_nil
    elif as_range:
        assert (start >= 0)
        assert (end >= 0)
        return W_ArrayObject(space, self.items_w[start:end], space.getnonsingletonclass(self))
    else:
        return self.items_w[start]

dataset/ETHPy150Open topazproject/topaz/topaz/objects/arrayobject.py W_ArrayObject.method_subscript/original