def __getitem__(self, key):
        if isinstance(key, slice):
            return [self[i] for i in xrange(*key.indices(len(self)))]
        elif isinstance(key, int):
            if key < 0:
                key += len(self)
            if key >= len(self) or key < 0:
                raise IndexError("Index out of range")
            return self.getValueAbsolute(key)
        else:
            raise TypeError("Invalid argument type")

    # This is similar to __getitem__ for ints, but it shouldn't raise for invalid positions.
Test that a standard log message doesn't go anywhere near the result.
dataset/ETHPy150Open gbeced/pyalgotrade/pyalgotrade/dataseries/__init__.py/DataSeries.__getitem__--crossover with--dataset/ETHPy150Open kuri65536/python-for-android/python-modules/twisted/twisted/trial/test/test_log.py/TestObserver.test_msg