'A file object is its own iterator, for example iter(f) returns f
(unless f is closed). When a file is used as an iterator, typically
in a for loop (for example, for line in f: print line), the next()
method is called repeatedly. This method returns the next input line,
or raises StopIteration when EOF is hit.'

def next(self):

    _complain_ifclosed(self.closed)
    r = self.readline()
    if (not r):
        raise StopIteration
    return r
