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

[3.7] bpo-37635: Update arg name for seek() in IO tutorial (GH-16147) #16151

Merged
merged 1 commit into from
Sep 14, 2019

Conversation

miss-islington
Copy link
Contributor

@miss-islington miss-islington commented Sep 14, 2019

Typically, the second positional argument for seek() is whence. That is the POSIX standard name (http://man7.org/linux/man-pages/man3/lseek.3p.html) and the name listed in the documentation for io module (https://docs.python.org/3/library/io.htmlGH-io.IOBase.seek).

The tutorial for IO is the only location where the second positional argument for seek() is referred to as from_what. I suspect this was created at an early point in Python's history, and was never updated (as this section predates the GitHub repository):

$ git grep "from_what"
Doc/tutorial/inputoutput.rst:To change the file object's position, use ``f.seek(offset, from_what)``.  The position is computed
Doc/tutorial/inputoutput.rst:the *from_what* argument.  A *from_what* value of 0 measures from the beginning
Doc/tutorial/inputoutput.rst:the reference point.  *from_what* can be omitted and defaults to 0, using the

For consistency, I am suggesting that the tutorial be updated to use the same argument name as the IO documentation and POSIX standard for seek(), particularly since this is the only location where from_what is being used.

Note: In the POSIX standard, whence is technically the third positional argument, but the first argument fildes (file descriptor) is implicit in Python.

https://bugs.python.org/issue37635
(cherry picked from commit ff603f6)

Co-authored-by: Kyle Stanley aeros167@gmail.com

https://bugs.python.org/issue37635

Automerge-Triggered-By: @pitrou

Typically, the second positional argument for ``seek()`` is *whence*. That is the POSIX standard name (http://man7.org/linux/man-pages/man3/lseek.3p.html) and the name listed in the documentation for ``io`` module (https://docs.python.org/3/library/io.htmlGH-io.IOBase.seek).

The tutorial for IO is the only location where the second positional argument for ``seek()`` is referred to as *from_what*. I suspect this was created at an early point in Python's history, and was never updated (as this section predates the GitHub repository):

```
$ git grep "from_what"
Doc/tutorial/inputoutput.rst:To change the file object's position, use ``f.seek(offset, from_what)``.  The position is computed
Doc/tutorial/inputoutput.rst:the *from_what* argument.  A *from_what* value of 0 measures from the beginning
Doc/tutorial/inputoutput.rst:the reference point.  *from_what* can be omitted and defaults to 0, using the
```

For consistency, I am suggesting that the tutorial be updated to use the same argument name as the IO documentation and POSIX standard for ``seek()``, particularly since this is the only location where *from_what* is being used.

Note: In the POSIX standard, *whence* is technically the third positional argument, but the first argument *fildes* (file descriptor) is implicit in Python.

https://bugs.python.org/issue37635
(cherry picked from commit ff603f6)

Co-authored-by: Kyle Stanley <aeros167@gmail.com>
Copy link
Member

@pitrou pitrou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@miss-islington
Copy link
Contributor Author

@aeros167: Status check is done, and it's a success ✅ .

@miss-islington miss-islington merged commit b9f932f into python:3.7 Sep 14, 2019
@miss-islington miss-islington deleted the backport-ff603f6-3.7 branch September 14, 2019 20:47
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 skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants