From ece349e51777ebc086c8f194fdb7d20f29daf445 Mon Sep 17 00:00:00 2001 From: Antoine Pitrou Date: Wed, 28 Apr 2010 19:53:35 +0000 Subject: [PATCH] State clearly that truncate() doesn't move the file position, and remove a duplicate of its specification. --- Doc/library/io.rst | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Doc/library/io.rst b/Doc/library/io.rst index cf5e9f766d2..9f08c25219c 100644 --- a/Doc/library/io.rst +++ b/Doc/library/io.rst @@ -319,7 +319,9 @@ I/O Base Classes .. method:: truncate(size=None) Truncate the file to at most *size* bytes. *size* defaults to the current - file position, as returned by :meth:`tell`. + file position, as returned by :meth:`tell`. Note that the current file + position isn't changed; if you want to change it to the new end of + file, you have to :meth:`seek()` explicitly. .. method:: writable() @@ -527,11 +529,6 @@ In many situations, buffered I/O streams will provide higher performance In :class:`BytesIO`, this is the same as :meth:`read`. - .. method:: truncate([size]) - - Truncate the buffer to at most *size* bytes. *size* defaults to the - current stream position, as returned by :meth:`tell`. - .. class:: BufferedReader(raw, buffer_size=DEFAULT_BUFFER_SIZE)