[Python-ideas] Replacing the standard IO streams (was Re: changing sys.stdout encoding)

Serhiy Storchaka storchaka at gmail.com
Sun Jun 10 16:34:08 CEST 2012


On 10.06.12 00:22, Mark Lawrence wrote:
> On 09/06/2012 21:02, Serhiy Storchaka wrote:
>> None of these methods are not guaranteed to work if the input or output
>> have occurred before.
>
> That's a double negative so I'm not sure what you meant to say. Can you
> please rephrase it. I assume that English is not your native language,
> so I'll let you off :)

open(sys.stdin.fileno()) is not guaranteed to work if the input or 
output have occurred before. And io.TextIOWrapper(sys.stdin.detach()) is 
not guaranteed to work if the input or output have occurred before. 
sys.stdin internal buffer can contains read by not used characters. 
sys.stdin.buffer internal buffer can contains read by not used bytes. 
With multibyte encoding sys.stdin.decoder internal buffer can contains 
uncompleted multibyte character.




More information about the Python-ideas mailing list