Serhiy Storchaka added the comment:
This is not always possible. Consider following example:
>>> open('temp.txt', 'wb').write(b'+BDAEMQQyBDMENA-')
16
>>> f = open('temp.txt', 'r+', encoding='utf-7')
>>> f.read(2)
'аб'
What should be the result of truncating?
I think it would be better to not implement truncate() for text files at all.
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue26158>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com