Staging
v0.8.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
clinic
stringlib
README -rw-r--r-- 41 bytes
abstract.c -rw-r--r-- 66.8 KB
accu.c -rw-r--r-- 2.4 KB
boolobject.c -rw-r--r-- 6.5 KB
bytearrayobject.c -rw-r--r-- 69.2 KB
bytes_methods.c -rw-r--r-- 22.4 KB
bytesobject.c -rw-r--r-- 99.1 KB
call.c -rw-r--r-- 37.2 KB
capsule.c -rw-r--r-- 7.3 KB
cellobject.c -rw-r--r-- 4.4 KB
classobject.c -rw-r--r-- 17.8 KB
codeobject.c -rw-r--r-- 27.3 KB
complexobject.c -rw-r--r-- 32.3 KB
descrobject.c -rw-r--r-- 54.9 KB
dict-common.h -rw-r--r-- 2.2 KB
dictnotes.txt -rw-r--r-- 6.0 KB
dictobject.c -rw-r--r-- 129.1 KB
enumobject.c -rw-r--r-- 13.3 KB
exceptions.c -rw-r--r-- 85.8 KB
fileobject.c -rw-r--r-- 14.9 KB
floatobject.c -rw-r--r-- 71.1 KB
frameobject.c -rw-r--r-- 34.4 KB
funcobject.c -rw-r--r-- 29.5 KB
genobject.c -rw-r--r-- 64.9 KB
iterobject.c -rw-r--r-- 9.0 KB
listobject.c -rw-r--r-- 95.4 KB
listsort.txt -rw-r--r-- 35.3 KB
lnotab_notes.txt -rw-r--r-- 5.7 KB
longobject.c -rw-r--r-- 166.4 KB
memoryobject.c -rw-r--r-- 88.9 KB
methodobject.c -rw-r--r-- 9.1 KB
moduleobject.c -rw-r--r-- 23.3 KB
namespaceobject.c -rw-r--r-- 7.2 KB
object.c -rw-r--r-- 61.7 KB
obmalloc.c -rw-r--r-- 84.3 KB
odictobject.c -rw-r--r-- 73.1 KB
rangeobject.c -rw-r--r-- 34.3 KB
setobject.c -rw-r--r-- 73.2 KB
sliceobject.c -rw-r--r-- 19.0 KB
structseq.c -rw-r--r-- 13.5 KB
tupleobject.c -rw-r--r-- 29.9 KB
typeobject.c -rw-r--r-- 239.8 KB
typeslots.inc -rw-r--r-- 3.9 KB
typeslots.py -rwxr-xr-x 1.2 KB
unicodectype.c -rw-r--r-- 7.5 KB
unicodeobject.c -rw-r--r-- 454.8 KB
unicodetype_db.h -rw-r--r-- 241.6 KB
weakrefobject.c -rw-r--r-- 29.5 KB

README

back to top