Antoine Pitrou <pit...@free.fr> added the comment: A couple of suggestions:
- if IncrementalNewlineDecoder gets an encoding argument, it can also instantiate the decoder itself; that way the API is a bit simpler - to encode '\r' without the BOM, you can e.g. use an incremental encoder and encode it twice: >>> enc = codecs.getincrementalencoder('utf16')('strict') >>> enc.encode('\r') b'\xff\xfe\r\x00' >>> enc.encode('\r') b'\r\x00' I think breaking the API can be ok since the original API is broken (witness this bug). There can even be a compatibility mode where we check whether `encoding` has an encode() method, and if it has, take it as the decoder object rather than the encoding name. _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue4574> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com