[Python-3000] Python 3.0a2 release
walter at livinglogic.de
Tue Nov 20 19:16:40 CET 2007
Guido van Rossum wrote:
> On Nov 19, 2007 3:06 PM, Amaury Forgeot d'Arc <amauryfa at gmail.com> 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
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.
More information about the Python-3000