On 01/20/16 14:50, Markus Armbruster wrote:
> 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.

Yes, I think I had

  (len_desc + 3) // 4

in mind (except I didn't know about "//" just yet :))

Thanks
Laszlo

Reply via email to