Skip to content

Commit 255f5b7

Browse files
committed
size(): remove redundant io.tell() (suggested by @armijnhemel)
See #61 (comment)
1 parent 486e9ab commit 255f5b7

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

kaitaistruct.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,8 @@ def size(self):
9999
io = self._io
100100
# Remember our current position
101101
cur_pos = io.tell()
102-
# Seek to the end of the File object
103-
io.seek(0, SEEK_END)
104-
# Remember position, which is equal to the full length
105-
full_size = io.tell()
102+
# Seek to the end of the stream and remember the full length
103+
full_size = io.seek(0, SEEK_END)
106104
# Seek back to the current position
107105
io.seek(cur_pos)
108106
return full_size

0 commit comments

Comments
 (0)