Author vstinner
Recipients ezio.melotti, lemburg, serhiy.storchaka, vstinner
Date 2017-03-10.14:53:11
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1489157591.97.0.417387498502.issue29783@psf.upfronthosting.co.za>
In-reply-to
Content
> codecs.open() works with bytes-to-bytes codecs.

Oh ok. What are non-text encodings? I found:

* base64
* bz2
* hex
* quopri
* rot13
* uu
* zlib

It seems like all these codecs can be used with codecs.open() to write bytes strings, except of rot13.

Last time I used these codecs was at least 5 years ago. When I ported code to Python 3, I used directly the module implementing the codecs (like base64 module for base64 codec). It's easy to write code working on Python 2 and Python 3 when using directly the module.


> In additional the interface of StreamReaderWriter is not fully compatible with the interface of io classes.

StreamReaderWriter has 3 addition attributes: reader, writer and stream. Do you expect that these attributes are used in the wild?

I expect that the most common uses of codecs.open() are to read or write text files.

The question is if it is easy to update the code for the rare cases using codecs.open() for other purposes. And if it is possible to write code working on Python 2.7 and 3.7.


> This would be compatible-breaking change.

It's deliberate, this issue breaks the backward compatibility.
History
Date User Action Args
2017-03-10 14:53:11vstinnersetrecipients: + vstinner, lemburg, ezio.melotti, serhiy.storchaka
2017-03-10 14:53:11vstinnersetmessageid: <1489157591.97.0.417387498502.issue29783@psf.upfronthosting.co.za>
2017-03-10 14:53:11vstinnerlinkissue29783 messages
2017-03-10 14:53:11vstinnercreate