Stephen Hansen schreef op de 26e dag van de zomermaand van het jaar 2010:

> There were various serious problems with Python 2 which could not be fixed in
> a backwards compatible way; we've been living with them for years and years
> now, and it was decided that a single break to go back and correct them would
> be preferable to keeping them forever.
> 
> From the fact that "strings" in Python 2 ended up doing double-duty as both
> octet sequences and arrays of character text, to yes the syntactical

I have been using Python 3 for quite some time now, and this 
string thing in Python 3 has caused me more headaches than it 
ever did in Python 2. Though it seems nice in theory to know 
exactly what type of bytes or string you have, you're working 
with a standard library that often doesn't know how to handle 
this distinction. The e-mail module is broken, as well as the 
cgi module. When I read a file from a zip archive, I can't open 
it as a binary stream, but I get binary anyway. I can't call 
os.system with a binary string, only with a text string, and 
that's encoded into utf-8, no matter what encoding I need.

Some basic text string functions seem to be working on byte 
string functions as well, but sometimes they don't, and there's 
no rhyme in why it does or doesn't.

    >>> 'abcd'[0] == 'abcd'[:1]
    True
    >>> b'abcd'[0] == b'abcd'[:1]
    False

Why????

In the end it may be all better, but at the moment, still a lot 
of work has to be done to fix the standard library. And then 
there's all those packages out there, that have to be ported... 
I still can't use numpy in Python 3.


-- 
Peter Kleiweg  L:NL,af,da,de,en,ia,nds,no,sv,(fr,it)  S:NL,de,en,(da,ia)
info: http://www.let.rug.nl/kleiweg/ls.html
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to