Skip to content

add SEEK_* values to io and/or io.IOBase #48822

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
gumpy mannequin opened this issue Dec 7, 2008 · 3 comments
Closed

add SEEK_* values to io and/or io.IOBase #48822

gumpy mannequin opened this issue Dec 7, 2008 · 3 comments
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@gumpy
Copy link
Mannequin

gumpy mannequin commented Dec 7, 2008

BPO 4572
Nosy @birkenfeld, @pitrou

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2009-04-01.21:01:02.040>
created_at = <Date 2008-12-07.04:44:22.364>
labels = ['type-feature', 'library']
title = 'add SEEK_* values to io and/or io.IOBase'
updated_at = <Date 2009-04-01.21:01:01.983>
user = 'https://bugs.python.org/gumpy'

bugs.python.org fields:

activity = <Date 2009-04-01.21:01:01.983>
actor = 'georg.brandl'
assignee = 'none'
closed = True
closed_date = <Date 2009-04-01.21:01:02.040>
closer = 'georg.brandl'
components = ['Library (Lib)']
creation = <Date 2008-12-07.04:44:22.364>
creator = 'gumpy'
dependencies = []
files = []
hgrepos = []
issue_num = 4572
keywords = []
message_count = 3.0
messages = ['77213', '78678', '85092']
nosy_count = 3.0
nosy_names = ['georg.brandl', 'pitrou', 'gumpy']
pr_nums = []
priority = 'normal'
resolution = 'accepted'
stage = None
status = 'closed'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue4572'
versions = ['Python 3.1', 'Python 2.7']

@gumpy
Copy link
Mannequin Author

gumpy mannequin commented 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)

@gumpy gumpy mannequin added stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels Dec 7, 2008
@pitrou
Copy link
Member

pitrou commented Jan 1, 2009

Sounds like a nice improvement.

@birkenfeld
Copy link
Member

Added in r70992.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants