]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
#4572: add SEEK_* values as constants in io.py.
authorGeorg Brandl <georg@python.org>
Wed, 1 Apr 2009 21:00:55 +0000 (21:00 +0000)
committerGeorg Brandl <georg@python.org>
Wed, 1 Apr 2009 21:00:55 +0000 (21:00 +0000)
Doc/library/io.rst
Lib/io.py

index fdacabb5a2cdf6554d11f39cb4b838bced310300..df6393c0768f995ccc6336b8c1c76e154003eab8 100644 (file)
@@ -265,12 +265,18 @@ I/O Base Classes
       interpreted relative to the position indicated by *whence*.  Values for
       *whence* are:
 
-      * ``0`` -- start of the stream (the default); *offset* should be zero or positive
-      * ``1`` -- current stream position; *offset* may be negative
-      * ``2`` -- end of the stream; *offset* is usually negative
+      * :data:`SEEK_SET` or ``0`` -- start of the stream (the default);
+        *offset* should be zero or positive
+      * :data:`SEEK_CUR` or ``1`` -- current stream position; *offset* may
+        be negative
+      * :data:`SEEK_END` or ``2`` -- end of the stream; *offset* is usually
+        negative
 
       Return the new absolute position.
 
+      .. versionadded:: 2.7
+         The ``SEEK_*`` constants
+
    .. method:: seekable()
 
       Return ``True`` if the stream supports random access.  If ``False``,
index 61206c427d0793d4de1fe010b38d80821ca7bed1..1cf9a18e6f5ec01f7912ea4a51cc7614af035168 100644 (file)
--- a/Lib/io.py
+++ b/Lib/io.py
@@ -66,6 +66,11 @@ import threading
 # open() uses st_blksize whenever we can
 DEFAULT_BUFFER_SIZE = 8 * 1024  # bytes
 
+# for seek()
+SEEK_SET = 0
+SEEK_CUR = 1
+SEEK_END = 2
+
 # py3k has only new style classes
 __metaclass__ = type