Wild idea of the day: Extend the syntax for list comprehensions to have an optional 'yield' to create a generator rather than a list. sizegen = [ yield (len(line),line) for line in file.readline() ] print 'Line 1:', g.next() print 'Line 2:', g.next() Raymond Hettinger