Commit 97eb832d authored by Guido van Rossum's avatar Guido van Rossum

support 'whence' arg to seek()

parent 56f81adb
......@@ -12,8 +12,13 @@ class _Mailbox:
self.fp = fp
self.seekp = 0
def seek(self, pos):
self.seekp = pos
def seek(self, pos, whence=0):
if whence==1: # Relative to current position
self.pos = self.pos + pos
if whence==2: # Relative to file's end
self.pos = self.stop + pos
else: # Default - absolute position
self.pos = self.start + pos
def next(self):
while 1:
......
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