[Python-Dev] Deprecate codecs.open() and StreamWriter/StreamReader
Victor Stinner
victor.stinner at haypocalc.com
Fri May 27 17:35:31 CEST 2011
Le vendredi 27 mai 2011 16:01:14, Nick Coghlan a écrit :
> On Fri, May 27, 2011 at 11:42 PM, M.-A. Lemburg <mal at egenix.com> wrote:
> > Wrong order: first write a PEP, then discuss, then get approval,
> > then patch.
>
> Indeed.
>
> If another committer says "please revert and better justify this
> change" then we revert it. We don't get into commit wars.
I reverted my controversal commit.
> Something does need to be done to resolve the duplication of
> functionality between the io and codecs modules, but it is *far* from
> clear that deprecating chunks of the longer standing API is the right
> way to go about it.
Yes, StreamReader & friends are present in Python since Python 2.0.
> This is especially true given Guido's explicit
> direction following the issues with the PyCObject removal in 3.2 that
> we be *very* conservative about introducing additional
> incompatibilities between Python 2 and Python 3.
I did search for usage of these classes on the Internet, and except projects
implementing their own codecs (and so implement their
StreamReader/StreamWriter classes, even if they don't use it), I only found
one project using directly StreamReader: pygment (*). I searched quickly, so
don't trust these results :-) StreamReader & friends are used indirectly
through codecs.open(). My patch changes codecs.open() to make it reuse open
(io.TextIOWrapper), so the deprecation of StreamReader would not be noticed by
most users.
I think that there are much more users of PyCObject than users using directly
the StreamReader API (not through codecs.open()).
(*) I also found Sphinx, but I was wrong: it doesn't use StreamReader, it just
has a full copy of the UTF-8-SIG codec which has a StreamReader class. I don't
think that the class is used.
Victor
More information about the Python-Dev
mailing list