You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently io.IOBase.seek(offset[, whence]) uses magic numbers for the
second argument. Since this is essentially identical the C function
fseek I think adding the same "constants" that C uses (SEEK_SET=0,
SEEK_CUR=1, SEEK_END=2) may be worth considering.
These values could be added to the global scope in the io module:
f = io.open('foo', 'rb')
f.seek(0, io.SEEK_END)
If added to the io.IOBase class then I believe they'd be accessible
without importing io:
f = open('foo', 'rb')
f.seek(0, f.SEEK_END)
Activity
gumpy commentedon Dec 7, 2008
Currently io.IOBase.seek(offset[, whence]) uses magic numbers for the
second argument. Since this is essentially identical the C function
fseek I think adding the same "constants" that C uses (SEEK_SET=0,
SEEK_CUR=1, SEEK_END=2) may be worth considering.
These values could be added to the global scope in the io module:
f = io.open('foo', 'rb')
f.seek(0, io.SEEK_END)
If added to the io.IOBase class then I believe they'd be accessible
without importing io:
f = open('foo', 'rb')
f.seek(0, f.SEEK_END)
pitrou commentedon Jan 1, 2009
Sounds like a nice improvement.
birkenfeld commentedon Apr 1, 2009
Added in r70992.