Kaydet (Commit) 6df27f8d authored tarafından Martin v. Löwis's avatar Martin v. Löwis

Support sizehint in _fileobject.readlines, as documented.

üst 543f2438
......@@ -228,10 +228,14 @@ class _fileobject:
data, self._rbuf = self._rbuf[:i], self._rbuf[i:]
return data
def readlines(self):
def readlines(self, sizehint = 0):
total = 0
list = []
while 1:
line = self.readline()
if not line: break
list.append(line)
total += len(line)
if sizehint and total >= sizehint:
break
return list
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment