unicode encoding usablilty problem

Nick Coghlan ncoghlan at iinet.net.au
Sun Feb 20 09:17:02 EST 2005


Martin v. Löwis wrote:
> People also argue that with such an approach, we could as well
> tell users to use array.array for the mutable type. But then,
> people complain that it doesn't have all the library support that
> strings have.

Indeed - I've got a data manipulating program that I figured I could make 
slightly less memory hungry by using arrays instead of strings.

I discovered very quickly just how inconvenient such a change would be in terms 
of the available API for manipulation of the byte array (the loss of 'join' 
support was a serious drawback). The program still uses strings for that reason.

However, I wonder if that might not be better solved by providing an 
"array.bytearray" that supported relevant portions of the string API (and easy 
conversion to a string), rather than blurring the concept of immutable strings.

Hmm - something else the PEP needs to discuss: What happens to __str__ and 
__unicode__? Is there a new __bytes__ slot?

I wonder if Skip is still up for championing this one. . .

Cheers,
Nick.
One PEP's enough for me (even though 338 doesn't seem to generate much interest)

-- 
Nick Coghlan   |   ncoghlan at email.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://boredomandlaziness.skystorm.net



More information about the Python-list mailing list