[Python-Dev] Status of the PEP 400? (deprecate codecs.StreamReader/StreamWriter)

Nick Coghlan ncoghlan at gmail.com
Thu Jul 28 03:00:09 CEST 2011


On Thu, Jul 28, 2011 at 9:38 AM, Guido van Rossum <guido at python.org> wrote:
>> Users of codecs.open() or users of codecs.Stream* classes?
>
> I would think both. Is there any reason to continue using codecs.open()?

It's the easiest way to write Unicode friendly code that spans both 2.x and 3.x.

The problem is that naive 2.x code will migrate to the optimised IO
stack automatically on the 2.x -> 3.x transition, while code that
tried to do the right thing has to be changed manually (either in 3.x
only, or by switching to the io module for 2.x as well) in order to
adjust for the differences in argument order.

The idea behind changing codecs.open to be a wrapper around io.open
was to allow such code to switch to the new optimised IO stack as
easily as code that just uses the open builtin. If it's acceptable for
the builtin behaviour to change (far more substantially), why not
change codecs.open as well?

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Python-Dev mailing list