def __getitem__(self, s):
        self._execute_query()

        if isinstance(s, slice):
            start = s.start if s.start else 0

            # calculate the amount of results that need to be loaded
            end = s.stop
            if start < 0 or s.stop is None or s.stop < 0:
                end = self.count()

            try:
                self._fill_result_cache_to_idx(end)
            except StopIteration:
                pass

            return self._result_cache[start:s.stop:s.step]
        else:
            try:
                s = int(s)
            except (ValueError, TypeError):
                raise TypeError('QuerySet indices must be integers')

            # Using negative indexing is costly since we have to execute a count()
            if s < 0:
                num_results = self.count()
                s += num_results

            try:
                self._fill_result_cache_to_idx(s)
            except __HOLE__:
                raise IndexError

            return self._result_cache[s]
dataset/ETHPy150Open datastax/python-driver/cassandra/cqlengine/query.py/AbstractQuerySet.__getitem__