[docs] [issue26158] File truncate() not defaulting to current position as documented

Serhiy Storchaka report at bugs.python.org
Tue Jan 19 12:24:43 EST 2016


Serhiy Storchaka added the comment:

This is because the file is buffered.

>>> open('temp.txt', 'w').write('ABCDE\nFGHIJ\nKLMNO\nPQRST\nUVWXY\nZ\n')
32
>>> f = open('temp.txt', 'r+')
>>> f.readline()
'ABCDE\n'
>>> f.tell()
6
>>> f.buffer.tell()
32
>>> f.buffer.raw.tell()
32

The documentation needs a clarification.

----------
assignee:  -> docs at python
components: +Documentation
nosy: +benjamin.peterson, docs at python, haypo, pitrou, serhiy.storchaka, steve.dower, stutzbach
versions: +Python 2.7, Python 3.6 -Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue26158>
_______________________________________


More information about the docs mailing list