Staging
v0.5.1
https://github.com/python/cpython
Revision b9f932f9e2a170a8d39b3c17f5fabb0967839d85 authored by Miss Islington (bot) on 14 September 2019, 20:47:39 UTC, committed by GitHub on 14 September 2019, 20:47:39 UTC

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 ff603f6c3d3dc0e9ea8c1c51ce907c4821f42c54)

Co-authored-by: Kyle Stanley <aeros167@gmail.com>
1 parent 4fac581
History
Tip revision: b9f932f9e2a170a8d39b3c17f5fabb0967839d85 authored by Miss Islington (bot) on 14 September 2019, 20:47:39 UTC
bpo-37635: Update arg name for seek() in IO tutorial (GH-16147)
Tip revision: b9f932f
File Mode Size
Python.asdl -rw-r--r-- 5.0 KB
acceler.c -rw-r--r-- 3.3 KB
asdl.py -rw-r--r-- 12.6 KB
asdl_c.py -rw-r--r-- 43.2 KB
bitset.c -rw-r--r-- 1.0 KB
firstsets.c -rw-r--r-- 2.8 KB
grammar.c -rw-r--r-- 7.4 KB
grammar1.c -rw-r--r-- 1.3 KB
listnode.c -rw-r--r-- 1.3 KB
metagrammar.c -rw-r--r-- 2.4 KB
myreadline.c -rw-r--r-- 10.6 KB
node.c -rw-r--r-- 4.4 KB
parser.c -rw-r--r-- 11.6 KB
parser.h -rw-r--r-- 1.2 KB
parsetok.c -rw-r--r-- 10.5 KB
parsetok_pgen.c -rw-r--r-- 35 bytes
pgen.c -rw-r--r-- 17.9 KB
pgenmain.c -rw-r--r-- 4.0 KB
printgrammar.c -rw-r--r-- 2.9 KB
tokenizer.c -rw-r--r-- 51.8 KB
tokenizer.h -rw-r--r-- 3.1 KB
tokenizer_pgen.c -rw-r--r-- 36 bytes

back to top