[Python-ideas] RFC: bytestring as a str representation [was: a new bytestring type?]
Ethan Furman
ethan at stoneleaf.us
Tue Jan 7 17:48:05 CET 2014
On 01/07/2014 05:00 AM, Stephen J. Turnbull wrote:
> Ethan Furman writes:
>>
>> I just read your proposal again, and must admit I don't understand
>> how it would help me, but I look forward to testing an
>> implementation!
>>
>> One wrinkle, though -- the data is binary, and if read would have
>> to be read using the latin1 codec...
>
> If you mean to process the binary, it would depend on what you want to
> do whether it would help or not. struct- and ctypes-style processing,
> no, it won't help because you need to convert to bytes to use those.
> (It might make sense to read the headers into a buffer this way, parse
> them as ASCII-compatible text, and then read the rest as bytes.) Pure
> byte code, doesn't help, although it probably doesn't hurt.
Sounds like it doesn't help me then. My binary stream is mixed:
- binary that has to be converted (4-byte ints, for example)
- ascii that has to be converted (ints stored as ascii text)
- encoded text (character and memo fields)
and the precise location of each varies from file to file.
--
~Ethan~
More information about the Python-ideas
mailing list