def __getitem__(self, slice_obj):
start, stop, step = normalize_slice(slice_obj, self.index.line_count)<EOL>if isinstance(slice_obj, slice):<EOL><INDENT>if step == <NUM_LIT:1>:<EOL><INDENT>return self._get_lines(start, stop)<EOL><DEDENT>return [self._get_lines(i)[<NUM_LIT:0>] for i in range(start, stop, step)]<EOL><DEDENT>if isinstance(slice_obj, int):<EOL><INDENT>return self._get_lines(start)[<NUM_LIT:0>]<EOL><DEDENT>return None<EOL>
Supports slice operations on the file

For example:

    with IndexedOpen(filename) as f:
        print f[6:-2]