python and bit shifts and byte order, oh my!

Reid Nichol rnichol_rrc at yahoo.com
Fri Sep 10 16:51:33 EDT 2004


Jason Lai wrote:
> If efficiency isn't important, you could forget about the whole 
> byte-order thing and just read/write it byte-by-byte. Then you can think 
> of the file as a bit-stream (everything gets written in order and read 
> back in order), although you still have to read/write a whole 8-bit byte 
> at a time.
> 
>  - Jason Lai

Since the format can have:
5bit
24bit
24bit

I assumed that I would have to write byte by byte.  And I don't really 
consider speed important so I think that it's viable to do it this way.

@Grant
This is what I meant.



More information about the Python-list mailing list