Bitstream -- Binary Data for Humans (Posting On Python-List Prohibited)
Le mardi 6 mars 2018 11:15:15 UTC+1, Terry Reedy a ?crit?:
> On 3/6/2018 3:58 AM, S?bastien Boisg?rault wrote:
> > Hi Lawrence,
> > Le mardi 6 mars 2018 01:20:36 UTC+1, Lawrence D?Oliveiro a ?crit?:
> >> On Tuesday, March 6, 2018 at 8:06:00 AM UTC+13, S?bastien Boisg?rault wrote:
> >>> I have released bitstream, a Python library to manage binary data
> >>> (at the byte or bit level), hopefully without the pain that this kind
> >>> of thing usually entails :)
> >>> byte_index = offset / 8
> >> This will return a float.
> byte_index // 8
> will give you the int index directly in both late 2.x and 3.x.
Indeed! And since this is Cython code, I *guess* that I should combine `//` with the 'cdivision' set to True to get the syntax that everyone understands *and* the pure C speed (see http://cython.readthedocs.io/en/latest/src/reference/compilation.html). I need to run some experiments to make sure that this behaves as expected, but this is very likely the way to go.
> Terry Jan Redey