Skip to content
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

io.IOBase docs often talk about byte offsets, but the same classes are used for string io types which use character offsets #122299

Closed
andmis opened this issue Jul 26, 2024 · 2 comments
Labels
docs Documentation in the Doc dir

Comments

@andmis
Copy link
Contributor

andmis commented Jul 26, 2024

The io.IOBase docs often talk about byte offsets, but the same classes often act as base classes for the string io types, which use character offsets.

PR fixing one such issue: https://github.com/python/cpython/pull/121421/files

Linked PRs

@vadmium
Copy link
Member

vadmium commented Jul 26, 2024

I wouldn’t call it a character offset; the number is not necessarily equal or even proportional to a number of characters. Consider multi-byte encodings, the newline encoder and decoder, and _pyio.StringIO with non-ASCII.

For character IO seeking, the offset is generally meant to be an opaque value returned by tell, or zero.

@picnixz
Copy link
Member

picnixz commented Dec 2, 2024

Considering that multiple core devs expressed their reservation, I will close this one as not planned. If you want to discuss it more in details and/or may suggest a better wording that would be accurate as well, feel free to @ me.

@picnixz picnixz closed this as not planned Won't fix, can't repro, duplicate, stale Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir
Projects
None yet
Development

No branches or pull requests

3 participants