Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0e4caf4

Browse files
committed
Merged revisions 70992,70995 via svnmerge from
svn+ssh://[email protected]/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__ ........
1 parent 1fd32a6 commit 0e4caf4

2 files changed

Lines changed: 16 additions & 4 deletions

File tree

Doc/library/io.rst

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -270,12 +270,18 @@ I/O Base Classes
270270
interpreted relative to the position indicated by *whence*. Values for
271271
*whence* are:
272272

273-
* ``0`` -- start of the stream (the default); *offset* should be zero or positive
274-
* ``1`` -- current stream position; *offset* may be negative
275-
* ``2`` -- end of the stream; *offset* is usually negative
273+
* :data:`SEEK_SET` or ``0`` -- start of the stream (the default);
274+
*offset* should be zero or positive
275+
* :data:`SEEK_CUR` or ``1`` -- current stream position; *offset* may
276+
be negative
277+
* :data:`SEEK_END` or ``2`` -- end of the stream; *offset* is usually
278+
negative
276279

277280
Return the new absolute position.
278281

282+
.. versionadded:: 2.7
283+
The ``SEEK_*`` constants
284+
279285
.. method:: seekable()
280286

281287
Return ``True`` if the stream supports random access. If ``False``,

Lib/io.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@
5252
__all__ = ["BlockingIOError", "open", "IOBase", "RawIOBase", "FileIO",
5353
"BytesIO", "StringIO", "BufferedIOBase",
5454
"BufferedReader", "BufferedWriter", "BufferedRWPair",
55-
"BufferedRandom", "TextIOBase", "TextIOWrapper"]
55+
"BufferedRandom", "TextIOBase", "TextIOWrapper",
56+
"SEEK_SET", "SEEK_CUR", "SEEK_END"]
5657

5758

5859
import _io
@@ -65,6 +66,11 @@
6566

6667
OpenWrapper = _io.open # for compatibility with _pyio
6768

69+
# for seek()
70+
SEEK_SET = 0
71+
SEEK_CUR = 1
72+
SEEK_END = 2
73+
6874
# Declaring ABCs in C is tricky so we do it here.
6975
# Method descriptions and default implementations are inherited from the C
7076
# version however.

0 commit comments

Comments
 (0)