[Python-Dev] Deprecate codecs.open() and StreamWriter/StreamReader

Terry Reedy tjreedy at udel.edu
Tue May 24 18:35:16 CEST 2011

On 5/24/2011 6:14 AM, M.-A. Lemburg wrote:

> I have no idea why TextIOWrapper was added to the stdlib
> instead of making StreamReaderWriter more capable,
> since StreamReaderWriter had already been available in Python
> since Python 1.6 (and this is being used by codecs.open()).

As I understand it, you (and others) wrote codecs long ago and recently 
other people wrote the new i/o stack, which sometimes uses codecs, and 
when they needed to add a few details, they 'naturally' added them to 
the module they were working on and understood (and planned to rewrite 
in C) rather than to the older module that they maybe did not completely 
understand and which is only in Python.

The Victor comes along to do maintenance on some of the Asian codecs and 
discovers that he needs to make changes in two (or more?) places rather 
than one, which he naturally finds unsatifactory.

> Perhaps we should deprecate TextIOWrapper instead and
> replace it with codecs.StreamReaderWriter ? ;-)

I think we should separate two issues: removing internal implementation 
duplication and removing external api duplication. I should think that 
the former should not be too controversial. The latter, I know, is more 
contentious. One problem is that stdlib changes that perhaps 'should' 
have been made in 3.0/1 could not be discovered until the moratorium and 
greater focus on the stdlib.

Terry Jan Reedy

More information about the Python-Dev mailing list