Josh Rosenberg added the comment:
For the record, the StringIO module is Python 2 only (replaced by io.StringIO
and io.BytesIO for Py3, which are also available on 2.6 and higher if you need
consistency), and only documents truncate by reference to the generic docs for
the built-in file object
New submission from Albert Zeyer:
The doc says that StringIO.truncate should not change the current position.
Consider this code:
try:
import StringIO
except ImportError:
import io as StringIO
buf = StringIO.StringIO()
assert_equal(buf.getvalue(), "")
print("buf: %r" % buf.getv