Kaydet (Commit) 88ed8f2c authored tarafından Georg Brandl's avatar Georg Brandl

#4572: add SEEK_* values as constants in io.py.

üst fff2f4bb
...@@ -265,12 +265,18 @@ I/O Base Classes ...@@ -265,12 +265,18 @@ I/O Base Classes
interpreted relative to the position indicated by *whence*. Values for interpreted relative to the position indicated by *whence*. Values for
*whence* are: *whence* are:
* ``0`` -- start of the stream (the default); *offset* should be zero or positive * :data:`SEEK_SET` or ``0`` -- start of the stream (the default);
* ``1`` -- current stream position; *offset* may be negative *offset* should be zero or positive
* ``2`` -- end of the stream; *offset* is usually negative * :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. Return the new absolute position.
.. versionadded:: 2.7
The ``SEEK_*`` constants
.. method:: seekable() .. method:: seekable()
Return ``True`` if the stream supports random access. If ``False``, Return ``True`` if the stream supports random access. If ``False``,
......
...@@ -66,6 +66,11 @@ import threading ...@@ -66,6 +66,11 @@ import threading
# open() uses st_blksize whenever we can # open() uses st_blksize whenever we can
DEFAULT_BUFFER_SIZE = 8 * 1024 # bytes DEFAULT_BUFFER_SIZE = 8 * 1024 # bytes
# for seek()
SEEK_SET = 0
SEEK_CUR = 1
SEEK_END = 2
# py3k has only new style classes # py3k has only new style classes
__metaclass__ = type __metaclass__ = type
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment