Bitstream -- Binary Data for Humans (Posting On Python-List Prohibited)

Sébastien Boisgérault sebastien.boisgerault at gmail.com
Tue Mar 6 04:51:05 EST 2018


Le mardi 6 mars 2018 10:23:02 UTC+1, Lawrence D’Oliveiro a écrit :
> On Tuesday, March 6, 2018 at 9:59:55 PM UTC+13, Sébastien Boisgérault wrote:
> > 
> > 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:
> >>>
> >>>    byte_index = offset / 8
> >> 
> >> This will return a float.
> > 
> > The implementation is in Cython, which allows to declare types. 
> > The variable byte_index is defined as a size_t. 
> 
> Ah, I see. Still it seems unPythonic to use ”/” for integer division. Does it not allow “//”?

Yes, '//' works, see:

    https://mybinder.org/v2/gh/boisgera/jupyter-cython/master?filepath=Integer%20Division.ipynb

Actually, in this Jupyter notebook setting, this is '/' that doesn't work!
I should have a new look at this; since performance also matters,
I'd also like to have the Cython code with the smallest overhead 
(even if it is less readable/Pythonic).

Cheers,

SB



More information about the Python-list mailing list