This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: StringIO's docs should mention overwriting of initial value/
Type: enhancement Stage:
Components: Documentation Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: eurleif, rhettinger
Priority: normal Keywords:

Created on 2005-04-10 22:55 by eurleif, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
pystringiooverwrite.txt eurleif, 2005-04-10 22:56 Documentation
Messages (2)
msg24997 - (view) Author: Leif K-Brooks (eurleif) Date: 2005-04-10 22:55
StringIO's initial file position is always set to 0,
rather than being set to the length of the initial
text. This isn't mentioned in the documentation, which
could cause confusion. I've attached some text the docs
could use.
msg24998 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2005-04-11 01:04
Logged In: YES 
user_id=80475

Okay, I added an explicit comment that the initial file
position is zero even when the object has been initialized
with a string.

FWIW, I recommend not using initialization when also using a
write method.  That will not allow a seemless conversion to
cStringIO where intialized objects are read-only.  A more
scalable technique is to create an empty object and then
call write() to initialize it.
History
Date User Action Args
2022-04-11 14:56:10adminsetgithub: 41843
2005-04-10 22:55:14eurleifcreate