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

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to