def __getitem__(self, i):
if isinstance(i, int):<EOL><INDENT>start = i<EOL><DEDENT>else:<EOL><INDENT>start = i.start<EOL><DEDENT>if start is None:<EOL><INDENT>start = <NUM_LIT:0><EOL><DEDENT>if start < <NUM_LIT:0>:<EOL><INDENT>start = len(self.text) + start<EOL><DEDENT>return TokenWithPosition(self.text[i], self.position + start)<EOL>
Access characters in object just as with strings.

        >>> t1 = TokenWithPosition('asdf', 2)
        >>> t1[0]
        'a'
        >>> t1[-1]
        'f'
        >>> t1[:]
        'asdf'