diff options
author | Guido van Rossum <guido@python.org> | 1996-01-25 18:40:41 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1996-01-25 18:40:41 (GMT) |
commit | 44a4d59b566a13d2054444a550866c9c5187571d (patch) | |
tree | b7e485144b0ec58c14e8d381fc40993980dbc456 /Lib | |
parent | 0eaa74bf8dbae21b7225cfd19bd0f996f5fd02de (diff) | |
download | cpython-44a4d59b566a13d2054444a550866c9c5187571d.zip cpython-44a4d59b566a13d2054444a550866c9c5187571d.tar.gz cpython-44a4d59b566a13d2054444a550866c9c5187571d.tar.bz2 |
support 'whence' arg to seek()
Diffstat (limited to 'Lib')
-rwxr-xr-x | Lib/mailbox.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Lib/mailbox.py b/Lib/mailbox.py index 8a54b46..e60b73b 100755 --- a/Lib/mailbox.py +++ b/Lib/mailbox.py @@ -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: |