Neil Cerutti <horpner at yahoo.com> writes: > i = 0 > while i < self.parent.GetPageCount(): > # do stuff > i += 1 Alternatively: from itertools import count for i in count(): if i >= self.parent.GetPageCount(): break ...