[Python-Dev] Deprecate codecs.open() and StreamWriter/StreamReader
Victor Stinner
victor.stinner at haypocalc.com
Tue May 24 12:50:28 CEST 2011
Le mardi 24 mai 2011 à 08:16 +0000, Vinay Sajip a écrit :
> > I opened an issue for this idea. Brett and Marc-Andree Lemburg don't
> > want to deprecate codecs.open() & friends because they want to be able
> > to write code working on Python 2 and on Python 3 without any change. I
> > don't think it's realistic: nontrivial programs require at least the six
> > module, and most likely the 2to3 program. The six module can have its
> > "codecs.open" function if codecs.open is removed from Python 3.4.
>
> What's "non-trivial"? Both pip and virtualenv (widely used programs) were ported
> to Python 3 using a single codebase for 2.x and 3.x, because it seemed to
> involve the least ongoing maintenance burden. Though these particular programs
> don't use codecs.open, I don't see much value in making it harder to write
> programs which can run under both 2.x and 3.x; that's not going to speed
> adoption of 3.x.
pip has a pip.backwardcompat module which is vey similar to six. If
codecs.open() is deprecated or removed, it will be trivial to add a
wrapper for codecs.open() or open() to six and pip.backwardcompat.
virtualenv.py starts also with a thin compatibility layer.
But yes, each program using a compatibily layer/module will have to be
updated.
Victor
More information about the Python-Dev
mailing list