Character set woes with binary data

Grant Edwards grante at visi.com
Sun Apr 1 15:27:24 EDT 2007


On 2007-04-01, Ene <EneUran at yahoo.com> wrote:
> On Apr 1, 11:44 am, John Nagle <n... at animats.com> wrote:
>> Michael B. Trausch wrote:
>> > In short:  How do I create a string that contains raw binary content
>> > without Python caring?  Is that possible?
>>
>> Given where we're now at with strings in Python, Python should
>> really have a "byte" type and a way to deal with arrays of
>> bytes, independent of the string operators.

I agree.  It would be very nice to have a built-in data-type
that is an efficient implementation of a list/array of bytes.
When manipulating binary data, it really makes it unreadable 
when it's full of chr() and ord() calls that are only there
because when you index into a string you get a string of length
1 and not a byte.

>>     Efficient handling of lists of bytes would do it.
>>
>>                                 John Nagle
>
> Python has a module base64 that allows you to handle binary
> data as a string.

Huh?  How does the base64 module address the problem?  It still
relies on the "string" type as an immutable list of bytes.

-- 
Grant Edwards                   grante             Yow!  I like your SNOOPY
                                  at               POSTER!!
                               visi.com            



More information about the Python-list mailing list