mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
Merged revisions 70992,70995 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r70992 | georg.brandl | 2009-04-01 16:00:55 -0500 (Wed, 01 Apr 2009) | 1 line #4572: add SEEK_* values as constants in io.py. ........ r70995 | benjamin.peterson | 2009-04-01 16:12:54 -0500 (Wed, 01 Apr 2009) | 1 line add seek constants to __all__ ........
This commit is contained in:
parent
1fd32a6731
commit
0e4caf4bd2
2 changed files with 16 additions and 4 deletions
|
@ -270,12 +270,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``,
|
||||||
|
|
|
@ -52,7 +52,8 @@ __author__ = ("Guido van Rossum <guido@python.org>, "
|
||||||
__all__ = ["BlockingIOError", "open", "IOBase", "RawIOBase", "FileIO",
|
__all__ = ["BlockingIOError", "open", "IOBase", "RawIOBase", "FileIO",
|
||||||
"BytesIO", "StringIO", "BufferedIOBase",
|
"BytesIO", "StringIO", "BufferedIOBase",
|
||||||
"BufferedReader", "BufferedWriter", "BufferedRWPair",
|
"BufferedReader", "BufferedWriter", "BufferedRWPair",
|
||||||
"BufferedRandom", "TextIOBase", "TextIOWrapper"]
|
"BufferedRandom", "TextIOBase", "TextIOWrapper",
|
||||||
|
"SEEK_SET", "SEEK_CUR", "SEEK_END"]
|
||||||
|
|
||||||
|
|
||||||
import _io
|
import _io
|
||||||
|
@ -65,6 +66,11 @@ from _io import (DEFAULT_BUFFER_SIZE, BlockingIOError, UnsupportedOperation,
|
||||||
|
|
||||||
OpenWrapper = _io.open # for compatibility with _pyio
|
OpenWrapper = _io.open # for compatibility with _pyio
|
||||||
|
|
||||||
|
# for seek()
|
||||||
|
SEEK_SET = 0
|
||||||
|
SEEK_CUR = 1
|
||||||
|
SEEK_END = 2
|
||||||
|
|
||||||
# Declaring ABCs in C is tricky so we do it here.
|
# Declaring ABCs in C is tricky so we do it here.
|
||||||
# Method descriptions and default implementations are inherited from the C
|
# Method descriptions and default implementations are inherited from the C
|
||||||
# version however.
|
# version however.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue