osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


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