Paolo Bonzini <pbonz...@redhat.com> writes: > On 20/01/2016 11:03, Janosch Frank wrote: >> >> In python 3: >> 1/2 == 0.5 >> 1//2 == 0 >> but a // b == floor(a/b), i.e. a cast is made. >> >> Anyway, I got rid of the import with: >> -(-len_desc // 4) > > I would change that to either: > > def ceil_div(a, b) > return -(-a // b) > > ... > > ceil_div(len_desc, 4) > > or > > (len_desc + 3) / 4
The latter is *far* easier on my eyes. But you'd still have to truncate for Python 3.