Repository navigation
io.[Text]IOBase.seek doesn't take keyword parameter - revisited #85864
Description
Activity
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?
- addeddocsDocumentation in the Doc dirDocumentation in the Doc dir3.8 (EOL)end of lifeend of life
on Sep 3, 2020 For the record, https://github.com/python/cpython/pull/14691/files reintroduced
whence=SEEK_SET.Since we have positional-only argument, can we document it as
seek(offset, whence=SEEK_SET, /)?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, /).
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.
- added a commit that references this issue
on Apr 23, 2022 Thanks for the patches @slateny!
Reacted by Stanley
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:
bugs.python.org fields: