Skip to content

io.[Text]IOBase.seek doesn't take keyword parameter - revisited #85864

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
andy-maier mannequin opened this issue Sep 3, 2020 · 6 comments
Closed

io.[Text]IOBase.seek doesn't take keyword parameter - revisited #85864

andy-maier mannequin opened this issue Sep 3, 2020 · 6 comments
Labels
3.8 (EOL) end of life docs Documentation in the Doc dir

Comments

@andy-maier
Copy link
Mannequin

andy-maier mannequin commented Sep 3, 2020

BPO 41698
Nosy @methane, @andy-maier, @tomerv

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 = None
created_at = <Date 2020-09-03.01:32:40.652>
labels = ['3.8', 'docs']
title = "io.[Text]IOBase.seek doesn't take keyword parameter - revisited"
updated_at = <Date 2021-10-21.05:52:51.694>
user = 'https://github.com/andy-maier'

bugs.python.org fields:

activity = <Date 2021-10-21.05:52:51.694>
actor = 'tomerv'
assignee = 'docs@python'
closed = False
closed_date = None
closer = None
components = ['Documentation']
creation = <Date 2020-09-03.01:32:40.652>
creator = 'andymaier'
dependencies = []
files = []
hgrepos = []
issue_num = 41698
keywords = []
message_count = 5.0
messages = ['376272', '376273', '376274', '376277', '404569']
nosy_count = 4.0
nosy_names = ['methane', 'docs@python', 'andymaier', 'tomerv']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = None
url = 'https://bugs.python.org/issue41698'
versions = ['Python 3.8']

@andy-maier
Copy link
Mannequin Author

andy-maier mannequin commented Sep 3, 2020

I stumbled across the problem reported in https://bugs.python.org/issue25030 on Python 3.8:

>>> with open('x.txt', 'a') as fp:
...   fp.seek(0, whence=os.SEEK_END)
... 
Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
TypeError: seek() takes no keyword arguments

Which I coded with a keyword argument because the documentation says so:

   seek(offset, whence=SEEK_SET)

See https://docs.python.org/3.8/library/io.html#io.IOBase.seek

The fix for issue bpo-25030 changed the documentation to:

   seek(offset[, whence])

and supposedly was integrated into 2.7, 3.4, and the default branch back then.

It seems the fix got lost?

@andy-maier andy-maier mannequin added the 3.8 (EOL) end of life label Sep 3, 2020
@andy-maier andy-maier mannequin assigned docspython Sep 3, 2020
@andy-maier andy-maier mannequin added docs Documentation in the Doc dir 3.8 (EOL) end of life labels Sep 3, 2020
@andy-maier andy-maier mannequin assigned docspython Sep 3, 2020
@andy-maier andy-maier mannequin added the docs Documentation in the Doc dir label Sep 3, 2020
@methane
Copy link
Member

methane commented Sep 3, 2020

For the record, https://github.com/python/cpython/pull/14691/files reintroduced whence=SEEK_SET.

@methane
Copy link
Member

methane commented Sep 3, 2020

Since we have positional-only argument, can we document it as seek(offset, whence=SEEK_SET, /)?

@andy-maier
Copy link
Mannequin Author

andy-maier mannequin commented Sep 3, 2020

Thanks for referencing the PR that reintroduced the old way of documenting it.

From my perspective, the proposal is fine. There are already some cases where it is documented like that, e.g. str.removeprefix(prefix, /).

@tomerv
Copy link
Mannequin

tomerv mannequin commented Oct 21, 2021

Just wanted to add that I encountered this today, went to file a ticket, and found this one. I'm fine with either style of documentation.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Apr 23, 2022
JelleZijlstra pushed a commit to JelleZijlstra/cpython that referenced this issue Apr 23, 2022
miss-islington added a commit that referenced this issue Apr 23, 2022
(cherry picked from commit a3f2cf3)

Co-authored-by: slateny <[email protected]>
JelleZijlstra added a commit that referenced this issue Apr 23, 2022
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Apr 30, 2022
miss-islington added a commit that referenced this issue Apr 30, 2022
miss-islington added a commit that referenced this issue Apr 30, 2022
@JelleZijlstra
Copy link
Member

Thanks for the patches @slateny!

hello-adam pushed a commit to hello-adam/cpython that referenced this issue Jun 2, 2022
hello-adam pushed a commit to hello-adam/cpython that referenced this issue Jun 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.8 (EOL) end of life docs Documentation in the Doc dir
Projects
None yet
Development

No branches or pull requests

2 participants