[issue20405] Add io.BinaryTransformWrapper and a "transform" parameter to open()

2014-02-10 Thread Martin Panter
Changes by Martin Panter : -- nosy: +vadmium ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pytho

[issue20405] Add io.BinaryTransformWrapper and a "transform" parameter to open()

2014-02-03 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: We already have stackable pieces for gzip, bz2 and lzma compressed streams -- GzipFile, BZ2File and LZMAFile. They are more powerful and more efficient than generic codecs.StreamReader/codecs.StreamWriter (and note that most binary codecs are just don't work

[issue20405] Add io.BinaryTransformWrapper and a "transform" parameter to open()

2014-02-03 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: On 03.02.2014 02:24, STINNER Victor wrote: > > STINNER Victor added the comment: > >> Ever used "recode" ? > > No, what is it? I once used iconv for short tests, but I never required iconv > to convert a real document. It's a command line tool to convert

[issue20405] Add io.BinaryTransformWrapper and a "transform" parameter to open()

2014-02-02 Thread STINNER Victor
STINNER Victor added the comment: > Ever used "recode" ? No, what is it? I once used iconv for short tests, but I never required iconv to convert a real document. > E.g. the example at the end of codecs.py allows using Latin-1 within > the application, while talking to the console using UTF-8.

[issue20405] Add io.BinaryTransformWrapper and a "transform" parameter to open()

2014-01-27 Thread Nick Coghlan
Nick Coghlan added the comment: Note that this is something that could (and should) start life as a module on PyPI, which would also provide cross version support. -- ___ Python tracker ___

[issue20405] Add io.BinaryTransformWrapper and a "transform" parameter to open()

2014-01-27 Thread Nick Coghlan
Nick Coghlan added the comment: I only used hex as the example because it was trivial to generate test data for. The stackable streaming IO model is an extremely powerful one - the approach we already use in the io module has some similarities to the one Texas Instruments use in DSP/BIOS (http

[issue20405] Add io.BinaryTransformWrapper and a "transform" parameter to open()

2014-01-27 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Nobody talks to the console using hex_codec. -- ___ Python tracker ___ ___ Python-bugs-list mailin

[issue20405] Add io.BinaryTransformWrapper and a "transform" parameter to open()

2014-01-27 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: On 27.01.2014 11:00, STINNER Victor wrote: > > STINNER Victor added the comment: > > I agree with Antoine, I dislike the idea of BinaryTransformWrapper, it > remembers me the evil codecs.EncodedFile thing. > > What are the usecases? Ever used "recode" ?

[issue20405] Add io.BinaryTransformWrapper and a "transform" parameter to open()

2014-01-27 Thread STINNER Victor
STINNER Victor added the comment: I agree with Antoine, I dislike the idea of BinaryTransformWrapper, it remembers me the evil codecs.EncodedFile thing. What are the usecases? -- ___ Python tracker __

[issue20405] Add io.BinaryTransformWrapper and a "transform" parameter to open()

2014-01-27 Thread Antoine Pitrou
Antoine Pitrou added the comment: That doesn't sound terribly useful indeed. The "hex" example is a toy example. Real-world examples would involve compression (zlib...) but then it is probably much more efficient to have a dedicated implementation (GzipFile) rather than blindly call zlib.compr

[issue20405] Add io.BinaryTransformWrapper and a "transform" parameter to open()

2014-01-26 Thread Nick Coghlan
Nick Coghlan added the comment: That's certainly a reasonable position to take - they use the same object->object model that the codecs module in general provides, which means Python 3.x can already handle the relevant use cases. Any such PEP would be about deciding whether or not binary trans

[issue20405] Add io.BinaryTransformWrapper and a "transform" parameter to open()

2014-01-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I think this is redundant because codecs.StreamReader and codecs.StreamWriter already exist. They are buggy, but now they are less buggy then at the time when Victor wrote PEP 400 and can be improved more. TextIOWrapper serves important special case, but for

[issue20405] Add io.BinaryTransformWrapper and a "transform" parameter to open()

2014-01-26 Thread Nick Coghlan
New submission from Nick Coghlan: Issue 20404 points out that io.TextIOWrapper can't be used with binary transform codecs like bz2 because the types are wrong. By contrast, codecs.open() still defaults to working in binary mode, and just switches to returning a different type based on the spec