Nick Coghlan <ncogh...@gmail.com> added the comment:

Indeed. However, the current alternatives (based on detach() and fileNo()) are 
also problematic - using detach() breaks the corresponding sys.__std*__ entry, 
while using fileNo() means you now have two independent IO stacks using the 
same underlying descriptor.

My own preference is to have a set_encoding() method that *can* be used even if 
IO has already occurred. Yes, there's the chance of mixing encodings if data is 
processed before the encoding is changed, but that's also true for both of the 
alternatives.

Pipeline applications written in Python should have an easy way to implement 
"--encoding" parameters for the standard IO streams, and a method to update the 
settings is the obvious choice.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue15216>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to