Steven D'Aprano writes:
 > On Mon, Mar 30, 2020 at 10:08:06PM -0700, Guido van Rossum wrote:

 > > StringIO was created in order to fit code designed to a file,
 > > where all you want to do is capture its output and process it
 > > further, in the same process.

 > But it does that by *building a string*, does it not?

Not all two-pass processes on external streams build strings
internally.  At least, earlier you insisted that StringIO is not a
string.

 > That's what the getvalue() method is for.

True, but there's no guarantee a given process will ever invoke it.
For example, I might read a file encoded as ISO-2022 into a StringIO,
then read that StringIO normalizing it to another StringIO as NFD,
then encode it to a file as UTF-8.  Look Ma, no .getvalue!

Steve
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/5BBJ3HVBA4F6RASCFRAGAUPGFOVEG3GI/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to