Guido van Rossum wrote: > On Nov 19, 2007 3:06 PM, Amaury Forgeot d'Arc <[EMAIL PROTECTED]> wrote: >> Guido van Rossum wrote: >>> Is there anything that you (or anyone else!) would really like to see >>> added to or fixed in 3.0a2? Now's the time! >> I am currently having a look at http://bugs.python.org/issue1460 . >> It's a problem in the utf-7 decoder (there is no such function >> PyUnicode_DecodeUTF7Stateful), but I was surprised to see that >> codec.StreamReader duplicates a lot of code already present in io.py: >> an underlying binary stream, a decoder, a buffer (of 72 chars), some >> code to handle \r\n and so on. >> >> I wonder if it is possible to remove this class: are there differences >> between codec.StreamReader and io.TextIOWrapper ? > > Good point. The redundancy is historic; StreamReader is older, and > performed the same function in 2.x that TextIOWrapper performs in 3.x, > but the latter was written from scratch (and in fact without looking > at the former) to match the API provided by text files in 2.x more > closely. If you see anything in StreamReader that could make > TextIOWrapper faster, I'd love to hear about it. I expect that in 3.0 > final, the classes in codecs will probably be implemented using > TextIOWrapper.
Reimplementing the streamreaders via TextIOWrapper basically would make much of the streamreader code go away. The streamreaders are supposed to be encoding specific wrappers for streams. TextIOWrapper implements this in *one* class (which uses the appropriate incremental decoder). A streamreader is basically just a TextIOWrapper where the encoding argument is fixed. The only question remaining is: do we need the streamreader classes at all. Servus, Walter _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com