[New-bugs-announce] [issue4572] add SEEK_* values to io and/or io.IOBase

gumpy report at bugs.python.org
Sun Dec 7 05:44:23 CET 2008


New submission from gumpy <gumpy2k7 at gmail.com>:

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)

----------
components: Library (Lib)
messages: 77213
nosy: gumpy
severity: normal
status: open
title: add SEEK_* values to io and/or io.IOBase
type: feature request
versions: Python 2.7, Python 3.0, Python 3.1

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4572>
_______________________________________


More information about the New-bugs-announce mailing list