What's a better way of doing the following? Iterators come to mind, but the need to get a variable lengths seems to screw that up. class dribbler(): def __init__(self, s): self.s = s self.i = 0 def get_next_n(self, n): s = self.s[self.i:self.i + n] self.i += n return s