overriding file.readline: "an integer is required"

Terry Reedy tjreedy at udel.edu
Tue Aug 5 21:46:57 CEST 2008

Gabriel Genellina wrote:

>>>>    def readline(self, size=None):
>>>>        if size == None:
>>>>            line = self.file.readline()
>>>>        else:
>>>>            line = self.file.readline(size)
>>>>        # etc., etc.

Not obvious from the docs, but readline(-1) should be the same as 
(In 3.0b2, None also works, but this is not yet documented.)  So try:

def readline(self, size=-1):
   line = self.file.readline(size)

More information about the Python-list mailing list