Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
69c70a2f
Commit
69c70a2f
authored
Mar 25, 1998
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support 'whence' parameter to seek().
parent
55730316
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
+11
-2
Lib/multifile.py
Lib/multifile.py
+11
-2
No files found.
Lib/multifile.py
View file @
69c70a2f
...
...
@@ -44,8 +44,17 @@ class MultiFile:
return
self
.
lastpos
return
self
.
fp
.
tell
()
-
self
.
start
#
def
seek
(
self
,
pos
):
if
not
0
<=
pos
<=
self
.
tell
()
or
\
def
seek
(
self
,
pos
,
whence
=
0
):
here
=
self
.
tell
()
if
whence
:
if
whence
==
1
:
pos
=
pos
+
here
elif
whence
==
2
:
if
self
.
level
>
0
:
pos
=
pos
+
self
.
lastpos
else
:
raise
Error
,
"can't use whence=2 yet"
if
not
0
<=
pos
<=
here
or
\
self
.
level
>
0
and
pos
>
self
.
lastpos
:
raise
Error
,
'bad MultiFile.seek() call'
self
.
fp
.
seek
(
pos
+
self
.
start
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment